Support » Plugin: WooCommerce » Change Checkout “Billing Details” text for a specific product in Woocommerce

  • Resolved ele

    (@luishgc93)


    i found this code, but dont work. ¿ any help ? i need it , thxxx

    add_filter(  'gettext',  'change_conditionally_checkout_heading_text', 10, 3 );
    function change_conditionally_checkout_heading_text( $translated, $text, $domain  ) {
        if( $text === 'Billing details' && is_checkout() && ! is_wc_endpoint_url() ){
            // HERE set the desired specific product ID
            $targeted_product_id = 1980;
            // Loop through cart items
            foreach( WC()->cart->get_cart() as $cart_item ) {
                if( $targeted_product_id == $cart_item['data']->get_id() )
                    return __( 'Your Details', $domain );
            }
        }
        return $translated;
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • cedcommerce

    (@cedcommerce)

    Hello @luishgc93 ,

    The above code is working absolutely fine.

    Make sure you added the same product, $targeted_product_id , i assigned my product id and it is working perfectly.

    And also ‘Billing details‘, this is case sensitive make sure you are using exactly same you have on your checkout page.

    Thanks,

    ele

    (@luishgc93)

    @cedcommerce let me see your code plss. My code is correct but dont work

    • This reply was modified 9 months ago by ele.
    cedcommerce

    (@cedcommerce)

    @luishgc93 ,

    add_filter(  'gettext',  'ced_checkout_heading_text', 10, 3 );
    function ced_checkout_heading_text( $translated, $text, $domain  ) {
        if( $text === 'Billing details' && is_checkout() && ! is_wc_endpoint_url() ){
    
            // HERE set the desired specific product ID
            $targeted_product_id = 182;
            // Loop through cart items
            foreach( WC()->cart->get_cart() as $cart_item ) {
                if( $targeted_product_id == $cart_item['data']->get_id() )
                    return __( 'CedCommerce ', $domain );
            }
        }
        return $translated;
    }

    I am using storefront theme.

    Thanks,

    Plugin Support kellymetal

    (@kellymetal)

    Hi there,

    We haven’t heard back from you in a while here, so I’m going to mark this thread as resolved.

    If you have any further questions, please start a new thread.

    Have a wonderful day!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change Checkout “Billing Details” text for a specific product in Woocommerce’ is closed to new replies.