• Resolved bungpm

    (@bl-solutions)


    When I include the vat switch into the product page using the short code, this is how the switch gets rendered:

    https://snipboard.io/Jqw1vz.jpg

    I cleared the cache without success.

    I am using the Thrive Themes Builder.

    Any advice would be greatly appreciated.

    Thanks and best,

    J?rn

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author wijnbergdevelopments

    (@wijnbergdevelopments)

    Hello J?rn,

    That’s strange. It looks like the CSS is not included at all. Could you please try to switch temporarly to a default theme so we can test that?

    Thread Starter bungpm

    (@bl-solutions)

    Thanks for your quick response.

    I just figured this out:

    Apparently, the block style is given the same id as the one you manually set when enqueueing the styles in the shortcode (wdevs-tax-switch-style).

    Possibly because I am not using Gutenberg/ the Thrive Themes theme does not them, WordPress does not actually enqueue the css-file when initializing the blocks.

    But afterwards, the id is taken.

    So when the shortcode is executed and tries to enqueue the css using the same id, nothing happens because WP thinks they already have been added to the header.

    Because of this, I was able to fix this by either changing the name of the block in block.json or by changing the style id in line 115 in class-wdevs-tax-switch-block.php, e.g., to wdevs-tax-switch-style-sc.

    https://snipboard.io/iA8EkF.jpg

    Plugin Author wijnbergdevelopments

    (@wijnbergdevelopments)

    Thank you for all the info! I’m trying to understand it, but this is a little strange; ‘WP thinks they already have been added to the header’. I’m not sure why WP wouldn’t actually have added it to the header, or why it is actually removed immediately?

    Did you disable Gutenberg by yourself or is Gutenberg disabled by The Thrive Theme? I’m asking you this because I would like to replicate this issue.

    Thread Starter bungpm

    (@bl-solutions)

    You should be able to replicate this by adding this filter to your functions.php and NOT using the block but only the shortcode to include the switch.

    add_filter( 'should_load_separate_core_block_assets', '__return_true' );

    Plugin Author wijnbergdevelopments

    (@wijnbergdevelopments)

    I’m sorry, but I just tried that and I can’t replicate the issue. I have;

    • added this add_filter( ‘should_load_separate_core_block_assets’, ‘__return_true’ ); to my functions.php in my child theme
    • Created a simpel page and added the shortcode. There is no Tax Switch Gutenberg Block added anywhere on the page. Only the shortcode. I’m 100% sure about this, because when I remove the shortcode, there isn’t any CSS or JS file loaded from plugin. As soon as I add the shortcode, the scripts and styles are loaded.

    Any other things I can try? If you contact me via my website, you can send me the URL if you want.

    Plugin Author wijnbergdevelopments

    (@wijnbergdevelopments)

    I think this is fixed in 1.2.4! I will mark this topic as ‘resolved’ for now. Please create another topic if you have other questions/issues.

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.