Support » Plugin: Non-Purchasable WooCommerce Products » How to target non-purchasable item

  • Resolved mtibbits


    Hi there,

    When an item is set as non-purchasable, I want to target the button on the single product page.

    I know that I can use the woocommerce_single_product_summary action hook, but it is targeting ALL products. How can I set a conditional so that ONLY the non-purchasable items are affected?


Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author GuyPrimavera


    Hi Matt,

    How do you want to target it? Is it to add some text or another function through a hook, or add some CSS styling?

    Basically something like this:

    remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_add_to_cart’, 30 );

    add_action(‘woocommerce_single_product_summary’, ‘custom_woocommerce_call_to_order_text’, 30);

    function custom_woocommerce_call_to_order_text() {

    echo ‘<a href=”” class=”button product_type_variable”>Contact Us For Pricing</a>’;


    Plugin Author GuyPrimavera


    Ok I see what you’re trying to do. There isn’t a hook to identify if the product is purchasable as far as I know, but you could just paste your a tag into this plugin’s settings and it should work: .

    Let me know if this solves the issue.

    • This reply was modified 1 year, 8 months ago by GuyPrimavera. Reason: link formatting

    Yeah I did that, and I get this:

    I would like to get rid of those 2 divs that are wrapping the <a> tag.

    I would have thought there would be a way to wrap my code in a conditional that checked to see if the “is purchasable” option was checked…

    Anyway, if I can’t then I can’t! Thanks for your response.


    Plugin Author GuyPrimavera


    Hi Matt,

    I’ve released a new version just now with an option to show exactly what you typed into the box in the settings, without the two wrapper DIVs.

    This should solve your problem, but just let me know if not.


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘How to target non-purchasable item’ is closed to new replies.