Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not working with variable products #59

Open
dcampbelllga opened this issue Mar 22, 2018 · 35 comments
Open

Not working with variable products #59

dcampbelllga opened this issue Mar 22, 2018 · 35 comments

Comments

@dcampbelllga
Copy link

I'm wondering why this doesn't seem to work with my variable products? It looked like you had added functionality for that, but it's not removing the stock on the page when I add an item to the cart (where it says 10 in stock right above the Add to Cart button). Am I setting it up incorrectly?

@jamesgol
Copy link
Owner

Without knowing exactly how you have the items setup and plugin configured it's tough to know if you have it setup incorrectly.

If you can provide some screen shots of the item setup and plugin configuration it would be a good start.

@dcampbelllga
Copy link
Author

Edit product ‹ Lake George Association — WordPress.pdf
Floating Classroom March 25 - Lake George Association.pdf
WooCommerce settings ‹ Lake George Association — WordPress.pdf

Hope these are helpful. It's a pretty simple setup. Just 1 product (a ticket) with 3 different variations in pricing (senior, adult, child). Everything else seems to be working with the plugin - countdown, etc. Just doesn't reduce the amount of stock listed above the button.

@dcampbelllga
Copy link
Author

It is set up as a virtual product if that makes any difference.

@jamesgol
Copy link
Owner

It looks like you don't have 'Manage Stock' checked

@dcampbelllga
Copy link
Author

I have it checked on the product but not on the variations. I have 30 tickets to sell total, and they can be any combination of senior, adult, or child tickets.

@jamesgol
Copy link
Owner

Ok that type of setup has definitely worked in the past. Do you have any sort of caching enabled?

@dcampbelllga
Copy link
Author

I think so, we have something called Comet Cache Pro in the menu. I didn't set up that portion of the site. I have to go pick up my kiddo from school but will be back in the office in the morning and possibly we can continue this thread then.

@jamesgol
Copy link
Owner

I've never used that particular cache plugin but that is likely the source of the problem. I have plans to make this plugin slightly more cache friendly, but I'm not sure when that will fit in my schedule.

It appears you can add a page URI to the cache exclusion list to ensure it will not be cached.
https://cometcache.com/kb-article/is-comet-cache-compatible-with-e-commerce-plugins-such-as-woocommerce/

@dcampbelllga
Copy link
Author

I'll try that in the morning and will let you know.

@dcampbelllga
Copy link
Author

Ok - so I tried that, and that didn't fix the issue.

@jamesgol
Copy link
Owner

You might need to clear your plugins cache and try again. A lot of the time those plugins work by saving a raw HTML file somewhere and then the webserver will check if the file exists to save the load of PHP actually running on the file.

By accessing your file I can see it is still serving the cached version.


<!-- *´¨)
--
  | ¸.•´¸.•*´¨) ¸.•*¨)
  | (¸.•´ (¸.•` ¤ Comet Cache is Fully Functional ¤ ´¨) -->
  |  
  | <!-- Cache File Version Salt:       n/a -->
  |  
  | <!-- Cache File URL:                https://www.lakegeorgeassociation.org/product/floating-classroom-march-25/ -->
  | <!-- Cache File Path:               /cache/comet-cache/cache/https/www-lakegeorgeassociation-org/product/floating-classroom-march-25.html -->
  |  
  | <!-- Cache File Generated Via:      HTTP request -->
  | <!-- Cache File Generated On:       Mar 23rd, 2018 @ 12:08 am UTC -->
  | <!-- Cache File Generated In:       1.21591 seconds -->
  |  
  | <!-- Cache File Expires On:         Mar 30th, 2018 @ 12:08 am UTC -->
  | <!-- Cache File Auto-Rebuild On:    Mar 30th, 2018 @ 12:08 am UTC -->
  |  
  | <!-- Loaded via Cache On:    Mar 23rd, 2018 @ 12:08 am UTC -->
  | <!-- Loaded via Cache In:    0.01194 seconds -->

@dcampbelllga
Copy link
Author

Unfortunately - still not working. I've cleared the Comet Cache Pro cache, cleared my browser cache, cleared the cache for the specific page ...

@jamesgol
Copy link
Owner

It looks like you at least have comet cache not caching that page now, which is good.

<!-- Comet Cache is NOT caching this page, because `$_SERVER['REQUEST_URI']` matches a configured URI Exclusion Pattern on this installation. -->

I have not had a chance to test the lastest WooCommerce (3.4) which you appear to be using. Though I did not see anything in their release notes that seemed related. Let me duplicate your setup locally and see if I can reproduce the issue.

Do you have any other WooCommerce related plugins installed?

@dcampbelllga
Copy link
Author

I'm using WooCommerce with WooCommerce Square and WooCommerce Table Rate Shipping - nothing else.

@dcampbelllga
Copy link
Author

I did just test it on other products (not variable, just simple products), and it worked perfectly.

@jamesgol
Copy link
Owner

Sorry about this. I can confirm it's not working. Let me troubleshoot and see if this is due to a recent WooCommerce change or maybe it is something I have already fixed in the development version that has not been released yet.

@dcampbelllga
Copy link
Author

Not a problem! Thank you for all of your help, and patience! I'm golden if we can get this working, so I'm so grateful for your assistance!

@jamesgol
Copy link
Owner

It does look like this is an issue I fixed in the dev version. If you would like to test it out you can download a zip from this GitHub repo. https://github.com/jamesgol/woocommerce-cart-stock-reducer/archive/master.zip

I've been planning on releasing a new version soon for a while now but I have not been able to find the time to do the testing of all the possible setups yet.

@dcampbelllga
Copy link
Author

I'll give this one a shot and let you know.

@dcampbelllga
Copy link
Author

That worked!!!

@dcampbelllga
Copy link
Author

I'm going to go with it since it is far better than where I started from. But one fix for the future - the countdown isn't cumulative. So in my instance, I have Senior, Adult, and Child tickets. I have 30 available. If I add 2 senior tickets, the stock shown goes down to 28 (yay!). Then I add 3 Adult tickets, but the stock shown only goes down to 27 (as it seems to only be reading the last entry, not the cart total). Just an FYI.

@jamesgol
Copy link
Owner

I can't reproduce that behavior on my test setup that I built just like yours.
Add 2 senior tickets: 28 available
Add 3 adult tickets: 25 available
In another browser:
Add 3 adult tickets: 22 available

@dcampbelllga
Copy link
Author

Hmm ... definitely not happening on mine like that. Also, it seems if I leave it sitting long enough, it takes all of my inventory out of stock and says that it is sold out (including on the back end). I added maybe 7 or 8 of the tickets to my cart and just left it, and going back in about 30 minutes later, it now has wiped out my entire stock.

@jamesgol
Copy link
Owner

I see that on your site, also your cart isn't working so I can't go and remove items after adding them.

@dcampbelllga
Copy link
Author

My cart page was private because we hadn't made most of this live yet while testing. I've made it love now.

@jamesgol
Copy link
Owner

Can you look at the WooCommerce status page wp-admin/admin.php?page=wc-status and see if it says there is 'External object cache:' enabled?

@dcampbelllga
Copy link
Author

I do not see that anywhere on that page. I also searched the page for "external" and nothing comes up.

@jamesgol
Copy link
Owner

That's weird, on my almost completely default setup it shows that even if not enabled. It is inside the "WordPress environment" box.

What theme are you using?

@dcampbelllga
Copy link
Author

It's a custom theme built by our developers

@jamesgol
Copy link
Owner

Is it based on another theme as a child theme? I'm trying to think of any possible reasons your site is not behaving like a stock site.

The object caching seems rather likely.

@dcampbelllga
Copy link
Author

It does not appear to be a child of another theme. When I go to Appearance, Themes, it just says the active theme is "lga"

@jamesgol
Copy link
Owner

I'm going to install the free version of comet cache on my testbed to see if it helps me reproduce the behavior. I'm not sure if there are any differences between the pro vs free version that would cause any issues.

@dcampbelllga
Copy link
Author

Knock on wood, but it seems to be leaving my stock totals alone now (on the back end) - I've added several tickets and let them expire, and I know that you were adding some too, and my stock hasn't changed. Still not resolved is the displayed stock total after adding a ticket type...

@jamesgol
Copy link
Owner

With the lite version of comet cache I can't reproduce the problem either. Looking at what they say the pro version provides I don't see anything that sounds like it would cause this problem.

I did just add a commit to the development version to try to keep pages with dynamic quantities from being cached. I don't know if that will help here or not, it will definitely keep the dynamic html from being cached but I don't know if it will keep a PHP object cache in line.

@dcampbelllga
Copy link
Author

Alright - well our website just crashed (of course), so I'm stuck for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants