How to access product’s meta data when deleting a WooCommerce product?

I’m not able to access the individual products for an order before the order is deleted.

add_action('before_delete_post', 'removeCheckDetail', 99, 2 );
function removeCheckDetail( $order_id ) {

global $woocommerce; 
global $wpdb; 

// $order = new WC_Order($order_id);
$order = wc_get_order( $order_id ); // This Works
error_log("Starting " .$order->get_id()); 

$order_items = $order->get_items(); 
error_log("Count: " .count($order_items)); // Returns 0

// Loop through order line items
foreach( $order_items as $item_id => $item ) {
    error_log("CartItemKey: " .$item->get_name()); // No Loops


Magento 2 Exclude Free shipping method for specific products

I have created one attribute for products, if that attribute value is yes than only it will be eligible for free shipping and other products will be excluded from free shipping. so when i add that product in the cart it wont count in free shipping.

plugin – magento 2 hide out of stock products except when a specific attribute equals yes

I would like to hide out of stock products generally so I’ve added the option in the store configuration settings. However there are certain products that will be restocked soon. I’d like to keep showing those.

Therefore I decided to add an attribute to them to mark them for restock att_restock.

However I’m not sure how to override the logic so that it works in the category, layered navigation and search results pages now. I’ve tried other solutions in

Where should I add my plugin in order to add my logic in the selection?

Any help is appreciated.

Need Gaming Writer for Game Pages and Game Products Pages

We need a native English writer for various gaming websites.

We need writer to write Game pages and Game products pages. Details will be shared in email.

If you think you are the right person to do the job, PM me.


php – Woocommerce sale flash badge not showing in products page

the problem that I have is this. I am just helping someone with their woocommerce/wordpress website, I am not very experienced with it but they need some urgent help. Basically, they want to show a badge whenever a product is on sale. I just found the way to do it and it is working fine, but only in the single product page. In the page of a single product, in the related products it shows the badge in the discounted products. But in the general products page it does not show anything.
This is the code I got for the single product pages:

function sales_badge( $text, $post, $product ) {
        return $tagType = '<span class="onsale"><img style="max-width: 150px;" src="sale.jpg"></span>';
add_filter('woocommerce_sale_flash', 'sales_badge', 99, 3 );

For the theme we are using: Astra and Elementor. I have tried everything and in google but could not find anything related with this. FYI: we are not using any plugin for this and we do not plan to.

How to create a script to export all products images in csv programmatically in Magento 2

Magento2 how to developed custom script export for list of all product images with associated sku, Alt-Text, Image path,Image size please if anyone creates the script to share with me as soon as possible

Indexing issue with Google to my Adult related products

Hello Webmasters,

I’m experiencing “
Child sexual abuse imagery is illegal” while trying to check my site’s page index in Google.

It is an online store offering adult related products similar to,
While checking my, it shows warning with 0 pages but while checking the same for lovehoney, it is showing number of pages.
can check it for
Any one who have experience with the sex toys or adult related products optimization, can help me better in this issue.
Is this issue due to its products which are Adult related? if so, then why not with Lovehoney ?
If not, then what is wrong I have done on my site?
Even in my search console, it is showing 392 pages under Coverage>Submitted and indexed with the status:Valid.
and whecking the same page by typing the exact url in google (as per search console), it is also shows zero result.

kindly help me in this issue.


postgresql – How can I model products with many-to-many ingredients and nested products?

I currently have three tables: product, ingredient, and product_ingredient (m2m relationship).

Product Ingredient relationship diagram

A product has many ingredients and nested products through product_ingredient. The nested products themselves have many ingredients and nested products.

How can I efficiently model these relationships so that a single query can select a product’s ingredients through all nested relationships?

  • The entities are read more frequently than written, so read optimized would be preferred.
  • The actual structure has foreign keys on the ingredient table which are aggregated in different ways.
  • The product ingredients should be ordered by their position int, with respect to its product_id.

magento2 – Magento 2 – Change amount of products per row in category view

Currently there are showing 4 products per row in the category view.

How can I make it show 3 products per row instead?

I found this answer. It says there is a file Magento_Catalogwebcsssourcemodule_listing.less but I searched in vendormagentomodule-catalogviewfrontendweb folder and there is not even a css folder inside of it.

import – Can’t change Custom Attribute when Importing Products

I have a custom attribute for my products called Designer_name. I’m trying to import products and change a Designer_name’s value in the additional_attributes column, but it doesn’t work. The attribute is of type “dropdown”, I have all values I want to use as options in the attribute, and it is in the attribute set that my products are in. It simply does not register when I import it.

When I make the attribute required, it gives me the error “1. Please make sure attribute “Designer_name” is not empty. in row(s): 2, 3
“. I have exported a product, changed the Designer_name’s value and tried to import it again, and this still happens. Has anyone else experienced this?

Note: I’m working with configurable products, not sure if it makes a difference, but I’m filling the value in all variations of the product. I’ve noticed that only the rows with the product variations throw the error, but those are filled with the custom attribute as well.

Note 2: I’ve tried adding Designer_name as a column of its own, and magento says it doesn’t exist. I’ve tried both with the configurable variations empty and filled.