lorro

WooCommerce - product-attribute.php for html attribute

Jan 24th, 2021 (edited)
541
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. // WooCommerce - product-attribute.php for html attribute
  3. if( 'attribute_with html_name' == $product_attribute['label'] ) {
  4.   $product_id = $product->get_id();
  5.   $ats = get_post_meta( $product_id, '_product_attributes', true );
  6.   foreach( $ats as $at ) {
  7.     if( 'attribute_with html_name' == $at['name'] ) {  
  8.       $product_attribute['value'] = html_entity_decode( $at['value'], ENT_COMPAT | ENT_HTML5 );
  9.     }
  10.   }
  11. }
  12. ?>
RAW Paste Data