Okay
  Public Ticket #4564092
Cannot Hide Add To Cart Button
Closed

Comments

  •  1
    Ian started the conversation

    Issue: Non-Purchasable dynamic rule for guest visitors is not hiding the Add to Cart button on product pages. Button remains visible to logged-out users.

    Environment:

    • Theme: WoodMart (B2BKing-approved)
    • Builder: WPBakery (custom product page template)
    • Cache: Cloudflare + local cache (both purged during testing)

    Rule configuration:

    • Rule type: Non-Purchasable
    • Applies to: Cart total / All products
    • For who: Guest visitors (not logged-in)
    • Status: Published

    Troubleshooting performed:

    1. Confirmed rule is saved and published
    2. Tested in separate browser (not logged in) — Add to Cart still visible
    3. Cleared local WP cache and Cloudflare cache (Purge Everything)
    4. Disabled WoodMart AJAX Add to Cart (Theme Settings → Single product → Add to cart)
    5. Disabled WoodMart AJAX Shop (Theme Settings → Product archive)
    6. Tested basic guest restriction "Hide prices" — button still showed
    7. Tested "Hide shop & products" — this worked, confirming B2BKing is functional for guests; issue is isolated to the Non-Purchasable rule hook not firing on the WPBakery custom product template

    Conclusion: B2BKing's guest restrictions work, but the Non-Purchasable rule does not remove the Add to Cart button when the product page is rendered via WPBakery custom layout in WoodMart.

  •  1
  •  2,724
    WebWizards replied

    Hi Ian,

    Thank you for purchasing our plugin!

    Just to confirm, is your main goal to show prices but hide the Add to Cart button for logged-out users?

    Non-purchasable rules do not always hide the button completely. This behavior depends heavily on the theme. We mark the product as not purchasable in WooCommerce data, but each theme implements this slightly differently. Some themes only gray out the button, while others hide it entirely. Since you are using a custom product page template with WPBakery, that is likely the issue.

     

    We would like to help you find a solution for this. I believe we can most likely resolve it using a PHP code snippet.

    To help us test and provide the exact code needed for your template, would it be possible to share a backend login to the site, or perhaps a staging clone where we can safely troubleshoot this directly?

     

    Kind regards,
    Stefan

  •   Ian replied privately
  •  1
  •  2,724
    WebWizards replied

    Hi Ian,

    Thanks for the access details.

    It looks like the theme was correctly marking the variations as non-purchasable, but its default behaviour was to still display the button. To resolve this, I added a custom CSS snippet here: https://magnusandsons.com/wp-admin/admin.php?page=wpcode-snippet-manager&snippet_id=10990

    I believe it is working correctly now: https://prnt.sc/oXINWLCErLYI

    Let me know if you spot any further issues or if there's anything else I can help with.

    Kind regards,
    Stefan

  •  1
    Ian replied

    Issue resolved! Thank you!