WooCommerce – Add an Editable Text at the top of Cart page

Sometimes client will ask you to promptly add some text at the top of cart page and they will have to change this text often.

One way of doing this would be to create Post or a Page that will be used as a ‘text holder’ and then call content of this post/page with the woocommerce_before_shop_loop hook.

Below you may find the proposed solution.

/**
 * Add an editable text at the top of the View Cart page.
 * Text is loaded from the wordpress Post/Page that you are going to create.
 * 1234 is the number of post/page ID that you will see in the url while you are editing the page.
 */
function get_shop_page_text(){
	$shop_page_object = get_post(1234); // 1234 is ID of the 'Editable text' page or post that you are going to create
	echo '<p>'.$shop_page_object->post_content.'</p>';
}

add_action( 'woocommerce_before_shop_loop', 'get_shop_page_text', 10 );

1 Star2 Stars3 Stars4 Stars5 Stars (2 votes, average: 3.00 out of 5)
Loading...Loading...
Oopps, sorry. This discussion is closed.

If you are a paying customer and you are looking for Tech Support please post a ticket on our Support Tickets page and we will respond promptly.

If you are not a paying customer and you would like to post a pre-sale question or a quote request please use our Contact form.

Why did we close the discussion?

Many of the customers started reporting issues as comments instead of the ticketing system and this started delaying our response time.

We are making this change to serve our customers better. We have ramped up our support team and we are trying to get the reply out on the same day.

Thanks for understanding.

heaslip@mailxu.com mapes-sqc@mailxu.com berdarjanelle@mailxu.com