WordPress.org

Forums

WooCommerce - excelling eCommerce
Existence of Product ID (2 posts)

  1. respectyoda
    Member
    Posted 1 year ago #

    Does anyone of you know the code to check to see if a specific product ID exists?

    https://wordpress.org/plugins/woocommerce/

  2. maksbd19
    Member
    Posted 6 months ago #

    I just had this problem and the following is my solution. Hope this might help someone in future :)

    $product = new WC_Product($product_id);
    
    if($product->product_type){
    	// as the product has a type that means the product exists !!!
    }

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.