WordPress.org

Forums

Insert PHP
I'm struggling with this code (2 posts)

  1. raiban
    Member
    Posted 1 year ago #

    Hi,

    I'm adding this to the Product Short Description to try and change the "Add to Cart" to "Pre-order", but it doesn't work (N.B. the PHP works fine when adding it to functions.php, but that changes all the buttons and I only want it for some pages):

    [insert_php]

    add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
    
    add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
    
    add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' );
    function woo_custom_cart_button_text()
    {
    return __( 'Pre-order', 'woocommerce' );
    }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    [/insert_php]

    Any idea why this is?
    The theme I'm using is woocommerce one called Blaszok.

    Any help will be deeply appreciated as I'm at my wits end with this :(

  2. WillBontrager
    Member
    Plugin Author

    Posted 9 months ago #

    Sorry, I can't help with Woo Commerce.

    This page might help with the scope issue.

    http://www.willmaster.com/software/WPplugins/insert-php-wordpress-plugin-instructions.php#functionscope

    For future reference, although I appreciate the starts, let me ask that you please use the Support area for support.

    Will

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Insert PHP
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.