• Resolved mitchellk

    (@mitchellk)


    I have an absolute mess on my blog with product blocks, it wasn’t like this before and I’ve even gone back to 3.3.0 and still cannot get this fixed.

    If I choose display 4 rows, it display 4 on the backend but 3 on the front end
    If I choose display 3 rows, it display 3 on the backend but 2 on the front end

    Additionally the Buy Now Buttons do not display. On the backend they show a small black block with no text and on the front end they do not display at all. After inspecting CSS to try and fix this I also notice that blocks is referencing CSS from twenty-twenty-one theme???? How can it reference another theme that is not active ???

    .theme-twentytwenty .wc-block-grid.has-5-columns .wc-block-grid__product, .theme-twentytwenty .wc-block-grid.has-6-columns.alignfull .wc-block-grid__product, .wc-block-grid.has-5-columns .wc-block-grid__product, .wc-block-grid.has-6-columns.alignfull .wc-block-grid__product

    also notice above how it mixing 6 columns and 5 columns together even though I selected 6 ???

    • This topic was modified 3 years, 11 months ago by mitchellk.
    • This topic was modified 3 years, 11 months ago by mitchellk.
Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support Dani F. a11n

    (@danielinhou)

    Hi @mitchellk ????

    Oh, that’s really odd. Let’s see if I can help you sort this out. I would like to ask you to test this with a default theme as Storefront. You could use the Health Check plugin to change the theme for the Administrator user only so that your site is not disrupted by the change.

    Give that a try and let me know if you notice any differences. If not please get back to me including a screenshot of that page from the backend and also a screenshot and link to the front end so that I can have a look and try to reproduce this on my site to research this further.

    Cheers!

    Thread Starter mitchellk

    (@mitchellk)

    Hi @danielinhou thanks for the reply. I switched to StoreFront and the missing button problem persisted. I did some digging and discovered this snippet I use to change the button text for all my variable products is the cause. I’ve been using this snippet for a very long time and it never caused a problem before in a button on a Gutenburg Product Block but now it does. So something has changed.

    
    add_filter( 'woocommerce_product_add_to_cart_text' , 'custom_woocommerce_product_add_to_cart_text' );
    function custom_woocommerce_product_add_to_cart_text() {
        global $product;    
        $product_type = $product->product_type;  
        switch ( $product_type ) {
    case 'variable':
                return __( 'Buy Now', 'woocommerce' );
            break;
    }
    } 
    

    The issue with rows not displaying properly is indeed caused by the Theme so I will raise that with them or try and bypass some parts of their JS / CSS on certain pages.

    Thread Starter mitchellk

    (@mitchellk)

    Hi @danielinhou temporary solution for now was to rename that in class-wc-product-variable.php and disable the snippet.

    Plugin Support Dani F. a11n

    (@danielinhou)

    Hey @mitchellk

    Glad to hear you got it working the way you needed it, thanks for the update! If I am getting this right the code you posted is intended to change the Select Options text that appears with the Variable products to the Buy Now text, right?

    As the WooCommerce blocks are under active development, extensibility interfaces are not final and are subject to change that’s probably why your custom code stopped working. It seems that you have already found a working solution but you could also do
    this with the Say What plugin.

    Keep me posted if you need any further help!

    Cheers!

    Thread Starter mitchellk

    (@mitchellk)

    Hi @danielinhou that’s correct I change the button text in the template file and that works but a new plugin I am using is also correctly doing it now versus my PHP snippet I had. So … for now, all is good and the way it should be ??

    Plugin Support Dani F. a11n

    (@danielinhou)

    Hi @mitchellk!

    So … for now, all is good and the way it should be ??

    OK, thanks for the update. So I’ll mark this thread as resolved now. If you have any further questions, I recommend creating a new thread.

    Cheers!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Product Blocks Messed Up’ is closed to new replies.