PluginUs.Net - Business Tools for WooCommerce and WordPress

[realize your idea - make your dreams come true]

Support Forum

You need to log-in to create request (topic) to the support

Cache + IconicWP Attribute Swatches

The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday. If you have problems with registration ask help on contact us page please
If you not got email within 24~36 business hours, firstly check your spam box, and if no any email from the support there - back to the forum and read answer here. DO NOT ANSWER ON EMAILS [noreply@pluginus.net] FROM THE FORUM!! Emails are just for your info, all answers should be published only here.
The support doesn work on Saturdays and Sundays, so some Friday requests can be answered on Monday.

Hi

I'm having an issue with the combination of WOOCS + IconicWP Attribute Swatches + Caching.

My issue is that prices inside the swatches (the Fee) do not get converted once a page has been cached.

I can see on initial page load (uncached) it will convert fine back and forth.
But after this, if I close and reopen in a new incognito window, the cached version does not change currency as expected.

  • I've enabled cached mode on WOOCS
  • I've tried both with transient and session mode on WOOCS

I've tried to find out what happens, and what I can see is that on an uncached page we will get the correct markup (<bdi> etc)
However once it's cached, this markup has been stripped out leaving only the price text without markup code.

I have replicated the issue on GridPane Redis Page Cache (server cache) as well as Swift Performance Lite (WP plugin cache)

Any idea what might cause this and how I can fix it?

Hello

My plugin redraws cached prices in ajax mode. But unfortunately it doesn't work with third party prices

 

 

The plugin in question (IconicWP Attribute Swatches) works with your plugin - only not when cache is used.

Is there some special function they need to wrap around the price display to make it work? Some specific markup?

To take a more simple example:

Let's say I just want to output somewhere on a page, a number, which is a price of something (anything).

<?php

global $WOOCS;

echo woocommerce_price($WOOCS->woocs_exchange_value(floatval(13.99)));

?>

How can I make sure this value is cacheable and will still convert with WOOCS?

Hello

Everything is a little more difficult!

there is data on the front (price formatting), there is also data that is used to calculate the new price

Let's say I just want to output somewhere on a page, a number, which is a price of something (anything). - Please  use  this  shortcode - https://currency-switcher.com/shortcode/woocs_show_custom_price  - and it will work with cache

Thank you! So I can just call do_shortcode() with that shortcode and my value and it should work? I'll try that.

 and it should work? - yes

Welcome;)

 

Thank you.
The shortcode works.

Is it acceptable to call the function directly instead of using do_shortcode? Since I'm calling this from inside a different filter call.

Example: $WOOCS->woocs_show_custom_price(['value' => floatval(13.99)]) ?

Or do you recommend the do_shortcode method instead?

Hello

yes I recommend using shortcode:

  1. price will work with cache
  2. your code will work correctly regardless of updating and changing the code of our plugin