Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // For each item in cart
- foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
- // Get product
- $_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
- // Get custom attribute
- $foobar = $_product->get_attribute( 'myCustomAttribute' );
- $foobar == true ? $foo = "true" : $foo = "false";
- ?>
- // Add table row with custom attribute as a data attribute
- <tr data-foo=<?php echo "$foo"; ?>>...Content in here</tr>
- <?php
- }
Add Comment
Please, Sign In to add comment