Posted By

j4v3d on 07/11/18


Tagged

php wordpress attributes product woocommerce


Versions (?)

WOOCOMMERCE: Add HTML to Product Attribute


 / Published in: PHP
 

Add HTML after replacing a string in a product attribute in WooCommerce - WordPress.

  1. function woo_new_product_tab_content_eu_standards() {
  2.  
  3. global $product;
  4.  
  5. $product_eu_standards = $product->get_attribute( 'eu-standards' );
  6. $product_eu_standards = str_replace('European Standards', '<h4 class="mb-0">European Standards</h4>', $product_eu_standards);
  7. $product_eu_standards = str_replace('EN', '<br>EN', $product_eu_standards);
  8. $product_eu_standards = str_replace('IEC','<br>IEC', $product_eu_standards);
  9.  
  10. echo $product_eu_standards;
  11.  
  12. }

Report this snippet  

You need to login to post a comment.