Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WooCommerce Add Product IDs To Checkout Body Class
- function woo_cart_items_id_in_body_class( $classes ){
- $cart = WC()->cart->get_cart();
- foreach( $cart as $cart_item ){
- $product = wc_get_product( $cart_item['product_id'] );
- $classes[] = 'cart-item-id-' . $product->get_id();
- }
- return $classes;
- }
- add_filter( 'body_class', 'woo_cart_items_id_in_body_class' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement