delete cart item from the carts when user login from other system
delete cart item from the carts when user login from other system
delete cart item from the carts when user login from other system
First you need to loop trough the posts, get all the 10 posts, based on their sales number. Then, you need to check if the current product ID is equal to any ID of the products you looped. If it is, then you show ‘best seller’ tag for the product. In your code, you are … Read more
I’d first get the attachment ID and with the attachment ID you could use wp_delete_attachment($att_id)
Need woocommerce function for getting cart list with items
I recently had a similar problem and it had something to do with the query’s posts_per_page parameter. Try setting it explicitly, like so: function custom_search_filter($query) { if ( !is_admin() && $query->is_main_query() ) { if ($query->is_search) { $query->set(‘posts_per_page’, 10 ); // Try setting it to the number you’ve set in the WordPress admin (Settings > Reading). … Read more
The list_attributes is a method of WC_Product class called with -> operator and the wc_display_product_attributes is a simple function. This will fix the issue: add_action ( ‘woocommerce_product_meta_start’, ‘show_attributes’, 25 ); function show_attributes() { global $product; wc_display_product_attributes( $product ); }
a. If your fine with a plugin dependency, ACF has this kind of functionality built in with the “Relationship” field. Relationship: https://www.advancedcustomfields.com/resources/relationship/ Reverse Query: https://www.advancedcustomfields.com/resources/querying-relationship-fields/ b. If you want to do this with just WP core, you would use custom fields. First, on the child product, store the IDs of the product pages it should … Read more
Use this code.. $downloads = $product->get_files(); $product_id = $product->id; foreach( $downloads as $key => $each_download ) { $query = “SELECT SUM( download_count ) AS count FROM {$wpdb->prefix}woocommerce_downloadable_product_permissions WHERE product_id = $product->id”; $count = $wpdb->get_var( $query ); if ( ! empty( $count ) ) { echo ‘<a href=”‘.$each_download[“file”].'”>Download (‘.$count.’)</a>’; } else { echo ‘<a href=”‘.$each_download[“file”].'”>Download</a>’; } … Read more
From a cursory overview, the cross-sells are added via the same ajax add to cart script as regular shop loop archive products and I don’t see a way to distinguish between when it’s a cross-sell and when it’s not. You could run a script conditionally only on the cart page, and then listen to the … Read more
// define the woocommerce_api_delete_order callback function action_woocommerce_api_delete_order( $id, $instance ) { // make action magic happen here… }; // add the action add_action( ‘woocommerce_api_delete_order’, ‘action_woocommerce_api_delete_order’, 10, 2 );