PHP WC how to access product units and unit?
-
I want to show the product units and unit (e.g. 10 Kg) next to the price and I am wondering how I can acess these attributes within the funcitons.php of my child theme.
I have the following function where Einheit_pa is a custom attribute. This I want to change to the product units and unit.add_filter( 'woocommerce_get_price_suffix', 'price_suffix', 99, 4 ); function price_suffix( $html, $product, $price, $qty ){ $ve = $product->get_attribute( 'Einheit_pa' ); $html .= ' (' . $ve . ')'; return $html; }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘PHP WC how to access product units and unit?’ is closed to new replies.