WordPress.org

Ready to get started?Download WordPress

Forums

Insert PHP
I'm struggling with this code (1 post)

5 stars
  1. raiban
    Member
    Posted 2 months 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 :(

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.