最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Woocommerce price in meta data

matteradmin8PV0评论

I'm using the WooCommerce plugin and I can't figure how to remove the meta price information. I'm trying to remove the price info from displaying when a product gets shared on Facebook and/or Twitter. The website does have Yoast SEO plugin also installed but I'm not seeing anyway to remove it. I have no price showed on the product page.

Does anyone know how to modify meta data information? I've found the meta customer information. Just not product.

UPDATE

Basically I want to remove this:

 <!-- Misc. tags -->
 <meta name="twitter:label1" content="Price"/>
 <meta name="twitter:data1" content="50 USD"/>
 <meta property="product:price:amount" content="50"/>
 <meta property="product:price:currency" content="USD"/>
 <meta property="product:availability" content="instock"/>
 <!-- is_singular | is_product -->

You can only see it when you do a view source. The Price gets shown whenever you copy and paste the link in any social media platform.

LAST UPDATE It was the Open Graph Facebook plugin. View Kashif Rafique response below in the comments.

I'm using the WooCommerce plugin and I can't figure how to remove the meta price information. I'm trying to remove the price info from displaying when a product gets shared on Facebook and/or Twitter. The website does have Yoast SEO plugin also installed but I'm not seeing anyway to remove it. I have no price showed on the product page.

Does anyone know how to modify meta data information? I've found the meta customer information. Just not product.

UPDATE

Basically I want to remove this:

 <!-- Misc. tags -->
 <meta name="twitter:label1" content="Price"/>
 <meta name="twitter:data1" content="50 USD"/>
 <meta property="product:price:amount" content="50"/>
 <meta property="product:price:currency" content="USD"/>
 <meta property="product:availability" content="instock"/>
 <!-- is_singular | is_product -->

You can only see it when you do a view source. The Price gets shown whenever you copy and paste the link in any social media platform.

LAST UPDATE It was the Open Graph Facebook plugin. View Kashif Rafique response below in the comments.

Share Improve this question edited Oct 29, 2018 at 16:35 cbloss793 asked Oct 26, 2018 at 17:26 cbloss793cbloss793 1031 silver badge6 bronze badges 6
  • Better add some code ..less info – user145078 Commented Oct 26, 2018 at 19:07
  • @LatheeshVMVilla I really wasn't sure what to add code wise because I can't see what code is calling it. View the updated question for the code I want to remove that gets put in the front end. – cbloss793 Commented Oct 26, 2018 at 19:38
  • how you are sharing? which page? woocommerce does not comes with share product feature..may be you can use javascript to remove it. – user145078 Commented Oct 26, 2018 at 19:42
  • If you just copy and paste the URL for a variation product page in any social media site, it pulls the price from the meta description. We do have Yoast and WP Bakery Page Builder installed, but I tried to do a search in those plugin folders and never found anything regarding Woocommerce. Qcode is installed that came with the theme that had some Woocomerce customization but it looks to be just style stuff. – cbloss793 Commented Oct 26, 2018 at 19:58
  • got any links to share? – user145078 Commented Oct 27, 2018 at 18:33
 |  Show 1 more comment

1 Answer 1

Reset to default 0

You can try the following filters available in Yoast WordPress SEO:

apply_filters( 'wpseo_twitter_metatag_key', 'name' );
Source: wpseo_twitter_metatag_key

apply_filters( 'wpseo_og_' . $og_property, $content );
Source: wpseo_og_' . $og_property

EDIT - Review after seeing the product URL

Yoast SEO is not generating the Twitter/FB meta tags. Open Graph for Facebook, Google+ and Twitter Card Tags plugin is responsible for rendering these meta tags.

Seems that plugin doesn't allow product level configuration for price. It offers few filters with the meta tags inserting function:

  1. fb_og_disable
  2. fb_og_enabled
  3. fb_og_output

You would like to study the code and extend the plugin as per your need. A simple and easy solution is comment out or remove the responsible code from wonderm00ns-simple-facebook-open-graph-tags/public/class-webdados-fb-open-graph-public.php file, but it is not a recommended and future-safe way.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far