WordPress For Non-Techies

[NEW] Remove Meta Per Single Product – WooCommerce | wordpressp

Rate this post

Need to remove, category and tag links from a single product?

There’s 2 steps. (1) The input and (2) the output.

Step 1 – You can use WordPress custom fields or a plugin like ACF to create a custom field named remove_meta.

Here’s the .json import file for ACF which sets up your field otherwise create a WordPress field like this :

custom field remove single product meta

Step 2 – Paste this PHP code at the end of your child themes functions file.

add_action( 'woocommerce_single_product_summary', 'remove_single_meta', 39 );
function remove_single_meta() {

if ( ! empty( get_post_meta( get_the_ID(), 'remove_meta', true ) ) ) {

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );

}}

Reader Interactions


Source link

Mazi

Mazi has nine years of web development experience with the past five years spent honing his skills with WordPress plugins and themes. He's an expert in WooCommerce and is the author of the Simple Sales Tax plugin, a popular sales tax compliance solution for WooCommerce. Brett understands the importance of excellent communication, prides himself on producing high-quality code, and is comfortable working solo or as part of a team.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button