• Resolved daverempel

    (@daverempel)


    I am using the mystile theme. I upgraded my test site to the lastest woocommerce update 2.4. My variable prices in the store now come up as free on the product page but are fine in the checkout page. I only used numerical values no “$” or other values for prices and I priced each variable. I am using Canadian dollars if that changes anything. I would appreciate any ideas how I can fix this. I am stumped. I tried updating permalinks and changing themes but that did not seem to help. I also tried updating the themework and updating the theme files that woocommerce identified as outdated. That did not help either.

    https://wordpress.org/plugins/woocommerce/

Viewing 15 replies - 31 through 45 (of 57 total)
  • Plugin Contributor Claudio Sanches

    (@claudiosanches)

    Screenshot from 2015 08 10 20 06 28

    Yep – I see the pricing now under variable product. And it’s showing on front end again correctly. Thank you.

    S.

    Plugin Contributor Claudio Sanches

    (@claudiosanches)

    @stardaug since WooCommerce 2.1 (or 2.0) we only show prices under variation level.

    I upgraded to 2.4.1 manually (by uploading the folder to my server via ftp). Plugin version shows up correctly in the dashboard. I also upgraded the database when prompted by WooCommerce to do so. Yet the price appears as ‘Free’ on some (not all) of my variable products. Could somebody please help me out here? My store has been pulled down for the time being till further notice 🙁

    Nik

    (@nikwindle)

    I just upgraded to 2.4.1 and ran the database thing but still found one item marked as ‘free’. I flushed the cache and that sorted it out so it maybe as simple as that SidKumar!

    Thanks Nik for the update. By flush, you mean flushing the browser cache?

    Also, I was testing out a few things on my local development copy. Apparently, the issue arises only for “out of stock” variations/products (I have enabled display of out of stock items in my shop) if that gives a clue to Claudio or one of the other developers. Simply increasing the stock quantity by 1 resolved the issue for the product I was testing on.

    Nik

    (@nikwindle)

    I’ve actually got W3TotalCache installed so I’ve got an ‘Empty all caches’ option. I don’t use the stock control options but perhaps this had the same effect and triggered a reload … I guess the test would be changing stock back to 0 and seeing if the price goes back to ‘free’.

    I also found all my flat rate shipping prices had some extra text added causing an error message, I deleted the surplus text and it now seems to be fine.

    Yup Nik. I was thinking along the same lines so I did revert the stock level to 0 and the price indeed went back to ‘Free’. I am currently restoring my webstore over a crappy internet connection back to 2.3.x to at least get it back online. I’ll leave my local copy on 2.4.1 to test any fixes Claudio may suggest. Also kicking myself for not having checked the development version thoroughly! Lesson for the future :/

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    SidKumarSingh “free” will show if it cannot find any visible variations.

    https://github.com/woothemes/woocommerce/blob/77b2316d80dc5855a6083761b7684e3005ecda09/includes/class-wc-product-variable.php#L140-L165

    A variation needs to be enabled, with a price set, and stock status set to instock. If this fails, it may reveal free. Can you check?

    Hi Mike

    I think I have edge cases here. Let me enumerate:

    Show Out of Stock items in catalog: Enabled
    Variation Enabled: True
    Variation Regular Price: set to value
    Variation Sale Price: set to value
    Stock quantity: 0
    Stock Status: Out of stock

    In cases where all variations are out of stock, WC is showing the product as free (this is changed behaviour, because till yesterday the exact same products were showing up correctly albeit with an ‘Out of Stock’ notification for the customer since backorders are not allowed).

    In cases where a few variations are out of stock, WC is not reporting the sale price on the out of stock items (again a change in behaviour from 2.3.x). Hitherto, even if all my ‘On Sale’ variations were out of stock, WC was faithfully showing a price range in lieu of the sale price to reflect the differential pricing of the variations. That’s gone now.

    Also, in the single product template, previously, WC would show the variation price beneath the drop down selectors once the customer had chosen the desired options. Now nothing shows up.

    I know I’m just listing down issue after issue but the site owner was really unhappy with what the store looked like today morning (largely my fault for not testing fully before pushing into production) and so I’m currently downgrading his WC version back to the last 2.3.x series but I would love to upgrade to the 2.4 build as soon as possible.

    Thanks for all the help and support.

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    SidKumarSingh https://github.com/woothemes/woocommerce/commit/42e99286c782d1b7cdb0e4a52e40babc0f269f58

    Found it, fixed in the above commit. This will either hide the price if no variation prices are found, or maintain the price if you are not hiding out of stock variations from the catalog.

    Aaah great! Now to pull this commit into my test environment. Correct me if I’m wrong but I just need to pull the class-wc-product-variable.php and replace the existing one, right?

    Will there be a 2.4.2 to include this fix anytime soon?

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Yes and yes

    I updated this file in my test build and things are slightly better in that ‘Free’ isn’t displaying anymore.

    I think the next step would be to modify the code such that if ‘Show Out of Stock items’ is true and price is not empty, it should return the price.

    One curious thing that I noticed and may be of interest to you Mike. I am using a child theme with a custom functions.php. In this I am hooking my custom functions to:

    1. Override the default ‘From-to’ range notation for variations with different pricing to show a simple ‘Starting from’ followed by the minimum price of the variation (irrespective of whether it is out of stock or not since the business logic for display is non-discretionary on this factor).

    2. Replace the default ‘Sale’ notation with a banner with maximum percentage discount available.

    In the first case, because I just need the minimum/maximum variation regular price and sale price, I am using the get_variation_price() (for current price) and get_variation_regular_price() (for regular price). From what I understood in the function definition, both these functions place calls to the get_variation_prices() function, which in turn calls the get_price() function that is part of the WC_Product class definition. Effectively the $price, $regular_price and $sale_price properties are not getting populated for the variation if it is out of stock. Hence those functions are turning up blanks (or previously ‘Free’ price tags).

    In the second case, since I need to calculate the discount for each variant and then display the lowest one, I am handling the price myself using get_post_meta(). In this case, I am checking for regular price and active price to both be populated and ignoring cases where regular price is blank (to avoid divide by zero situations). Out of Sale notification are handled by a filter hook on woocommerce_get_availability that displays a custom Out of Sale notice. In this case I am getting proper results where the sales banner is getting the correct sales percentage irrespective of whether the variation is In Stock or not.

    Since I am using the Mystile theme, I even thought to switch back once to the parent theme and give it a go but in line with my expectation, it was the same behaviour. (Plus the same child theme was working till yesterday so my deduction is that something changes in the function my custom functions are calling, causing a break in functionality).

    So, I’m going to get down into the bowels of the php code to see if I can fix it (on my local copy, of course. Live store is back to 2.3 for now.) Please do let me know if you figure something out before I do (odds on you will!)

    Plugin Author Mike Jolley (a11n)

    (@mikejolley)

    Saving the product will flush cache and fix that.

    As for customising prices, there are filters in place to do this but I cannot provide the code for this.

Viewing 15 replies - 31 through 45 (of 57 total)
  • The topic ‘Variable prices coming up free after upgrade to 2.4’ is closed to new replies.