Search
 
SCRIPT & CODE EXAMPLE
 

PHP

woocommerce remove add to cart

// functions.php
add_filter( 'woocommerce_loop_add_to_cart_link', '__return_false' );
Comment

woocommerce remove category from product page

remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
Comment

remove product from cart by id woocommerce

foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
     if ( $cart_item['product_id'] == $your_product_id_here ) {
          WC()->cart->remove_cart_item( $cart_item_key );
     }
}
Comment

Delete a product by ID using PHP in WooCommerce

$product_id = 108;
wp_delete_post( $myproduct->ID, true); // Set to False if you want to send them to Trash.
Comment

delete product without removing taxonomy woocommerce

-- Remove all product attributes from WooCommerce
DELETE FROM wp_terms WHERE term_id IN (SELECT term_id FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%');
DELETE FROM wp_term_taxonomy WHERE taxonomy LIKE 'pa_%';
DELETE FROM wp_term_relationships WHERE term_taxonomy_id not IN (SELECT term_taxonomy_id FROM wp_term_taxonomy);

-- Delete all WooCommerce products and product variation
DELETE FROM wp_term_relationships WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type IN ('product','product_variation'));
DELETE FROM wp_posts WHERE post_type IN ('product','product_variation');

-- Delete orphaned postmeta
DELETE pm FROM wp_postmeta pm
LEFT JOIN wp_posts wp ON wp.ID = pm.post_id
WHERE wp.ID IS NULL
Comment

PREVIOUS NEXT
Code Example
Php :: php hash 
Php :: curl php 
Php :: range in php 
Php :: how to share a helper globally laravel 
Php :: laravel select count 
Php :: $conn php 
Php :: php not recognized internal external command 
Php :: laravel search user details by specific role 
Php :: php clone datetime 
Php :: keep only n elements of array php 
Php :: php binary to base64 
Php :: laravel created_at changing 
Php :: laravel default authentication redirectTo 
Php :: Automatically Delete Woocommerce Images After Deleting a Product 
Php :: contact form 7 remove p 
Php :: php createFromFormat day of week 
Php :: update role spatie 
Php :: laravel create new request 
Php :: creating thumbnail in codeigniter 
Php :: laravel set session timeout 
Php :: php catch exception 
Php :: get domain url with https in laravel 
Php :: php date set utc 
Php :: compare php date with mysql date 
Php :: php time 
Php :: how unique field in table in phpmyadmin 
Php :: Target class [BannerController] does not exist. 
Php :: tableau aléatoire php 
Php :: delete previous uploaded image when update laravel 
Php :: excerpt more wordpress 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =