I want to move the objects
-
Here is a photo example of what im trying to do: https://i.ibb.co/SRs8MRF/Screenshot-20201011-090808.png
I want to move the “X” button to above the thumbnail (added via code below in my functions.php)
// Product thumbnail in checkout add_filter( 'woocommerce_cart_item_name', 'product_thumbnail_in_checkout', 20, 3 ); function product_thumbnail_in_checkout( $product_name, $cart_item, $cart_item_key ){ if ( is_checkout() ) { $thumbnail = $cart_item['data']->get_image(array( 80, 80)); $image_html = '<div class="product-item-thumbnail">'.$thumbnail.'</div> '; $product_name = $image_html . $product_name; } return $product_name; }
I want to move the quantity amount below the Category & brand, (also added via code in my functions.php)
// Custom funtion that return the formatted category(ies) and attribute 'brand' term names function get_categories_and_brand_html( $product_id ){ $product = wc_get_product($product_id); $cat_names = (array) wp_get_post_terms( $product_id, 'product_cat', ['fields' => 'names'] ); $brand_name = $product->get_attribute('brand'); $output = ''; if ( ! empty($cat_names) || ! empty($brand_name) ) { $output .= '</br><span class="posted_in">'; if ( ! empty($cat_names) ) { $output .= implode(', ', $cat_names); } if ( ! empty($cat_names) && ! empty($brand_name) ) { $output .= ' | '; } if ( ! empty($brand_name) ) { $output .= $brand_name; } $output .= '</span>'; } return $output; } // Display term names in checkout page add_filter( 'woocommerce_checkout_cart_item_quantity', 'category_brand_after_checkout_item_name', 100, 3 ); function category_brand_after_checkout_item_name( $quantity, $cart_item, $cart_item_key ) { $terms_html = get_categories_and_brand_html( $cart_item['product_id'] ); if ( is_checkout() && ! empty($terms_html) ) { $quantity .= $terms_html; } return $quantity; }
The page I need help with: [log in to see the link]
- The topic ‘I want to move the objects’ is closed to new replies.