• Been hacking away at this for days now, I managed to get some of it working to an extent, but I am a little stuck on modifying the prices of variations…

    So here’s the thing… I am reading a feed from a product supplier, which I end up, with the use of xpath, generating a csv file that I then in turn import into the product catalogue in woocommerce. Basically, my client gets various discounts on product level from multiple suppliers, and therefore he needs a system that can provide a tier-level membership. Each tier will calculate discounts differently on product level. At this point, I am trying to calculate discount on a bronze level. So, I define the discount percentage for that tier on a product in a custom field. Then, using the following filters in my theme’s functions file: woocommerce_get_price, woocommerce_get_regular_price, I retrieve the discount percentage from the custom field on the product, then I calculate the discount amount, and subtract it from the price returned by the product. This all works just swell, pretty much, all over the show, however, the issue that I am having is when you change your selections on a variable product, between size and colours, the price that it returns is indeed the discounted amount, but on selection change, for size, prices are different. Since I am doing my calculation on the price returned on the variation master’s minimum price, the calculated value is never recalculated. It uses the calculated value on load and subtracts that same amount from each variable price. I need to recalculate the amount to be subtracted from the selected variation’s price. I really hope I’m making sense, cause it’s quite confusing to me.

    Basically, in short, the amount has to be recalculated on the total price of the selected variation, and then deducted from that total price to show saving amount.

Viewing 1 replies (of 1 total)
  • Suggest that you seek support from the woocommerce website and plugin support forums, the relevant experience is to be found there.

Viewing 1 replies (of 1 total)
  • The topic ‘Custom Discount on Products, modifying price output for variable products’ is closed to new replies.