Conversation
supportHi, Any way I can add a class in cart/checkout item line so I can style the “force sell” products somewhat different? Or a filter hook or something I can use for this?
Hi, “force sell” products are just standard products. You can edit them like any other WooCommerce product in the cart. Code would be something like add_filter( 'woocommerce_cart_item_class', 'cart_item_class_78356783443856', 10, 3 ); function cart_item_class_78356783443856( $class, $cart_item, $cart_item_key ) { if ( ! empty( $cart_item['linked_to'] ) ) { $class .= ' your-custom-class'; } return $class; } Regards, Dmytro
Hi, “force sell” products are just standard products. You can edit them like any other WooCommerce product in the cart. Code would be something like add_filter( 'woocommerce_cart_item_class', 'cart_item_class_78356783443856', 10, 3 ); function cart_item_class_78356783443856( $class, $cart_item, $cart_item_key ) { if ( ! empty( $cart_item['linked_to'] ) ) { $class .= ' your-custom-class'; } return $class; } Regards, Dmytro