• Resolved paulagaces

    (@paulagaces)


    Hi,

    I created a custom tab to add delivery information for all products. This information could be different for each product.
    Is there a possibility to get the text of this custom tab to display it in the cart and checkout pages?

    Thank you for your help
    Regards

    • This topic was modified 6 years ago by paulagaces.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @paulagaces,

    This isn’t something we typically like to do because it is a bit involved. Are you familiar with PHP and WordPress/WooCommerce? Have you customized any of the WooCommerce templates (i.e. have you used WooCommerce’s template hierarchy and replaced layouts via your theme?)

    Regardless, we can certainly make the attempt!

    Let us know.

    Thank you,
    Kevin.

    Thread Starter paulagaces

    (@paulagaces)

    Hi @yikesitskevin,

    Thank you for your answer.

    I am familiar with PHP and WordPress/WooCommerce. I already implemented a Storefront child template customized using snippets in the functions.php file.

    I am only interested to know how to get the text of a custom tab. I know how to display information in the cart and checkout pages.

    Regards

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Hi @paulagaces,

    Awesome!

    This snippet should be enough to get you going. Our data is saved as an array in the post meta table with the key yikes_woo_product_tabs.

    // Assuming the global $post object is available.
    $custom_product_tabs = get_post_meta( $post->ID, 'yikes_woo_products_tabs', true );
    
    if ( ! empty( $custom_product_tabs ) ) {
    	foreach( $custom_product_tabs as $tab ) {
    
    		// Assuming the tab title is called Delivery Information
    		if ( isset( $tab['title'] ) && $tab['title'] === 'Delivery Information' ) {
    
    			// Wrap in any markup you desire!
    			echo $tab['content'];
    		}
    	}	
    }

    If you need more info, just ask.

    Cheers,
    Kevin.

    Thread Starter paulagaces

    (@paulagaces)

    Hi @yikesitskevin,

    Great!!!
    Thank you very much for your help. It is working like a charm.

    Regards

    Plugin Contributor yikesitskevin

    (@yikesitskevin)

    Awesome! If you ever need any more help with similar customizations, you know where to find us.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Display custom tab text in cart and checkout’ is closed to new replies.