You simply can use the existing function get_page_by_path()
for this, which has a third parameter $post_type
you can specify. In your case a post from the custom post type product
is what you want.
Basic example:
$product_obj = get_page_by_path( $slug, OBJECT, 'product' );
Related Posts:
- Display single product attribute value on Shop page (Woocommerce)
- Where is the “default attribute” values located in the phpMyAdmin in Woocommerce?
- Extend Woocommerce rest api routes fails
- woocommerce_before_calculate_totals in woocommerce 3.0
- How to get all attributes with their terms related to specific Woocommerce product category [closed]
- Remove “Choose An Option” on Product Variation & Auto Select Instead
- why featured product not updated in postmeta table in woocommerce?
- Programmatically adding product attributes to WP / Woo commerce
- Woocommerce custom search
- Get product variation attribute titles – WooCommerce
- How to change Attribute Type
- WooCommerce – buying as well as selling
- Is it possible to merge Woocommerce attributes? [closed]
- Best Practice – Customise a WooCommerce+WordPress Templates
- WooCommerce: One term for Many Product Attributes
- How to remove product attribute row woocommerce using code
- WooCommerce Simple Product Options List
- Woocommerce: Any way to list all products *without* a specific attribute?
- How to add product variations for large number of products in WooCommerce?
- WooCommerce: how to set stock per attribute on variable product
- Importing Attributes in to Woocommerce
- Woocommerce: Some action hooks not firing inside class [closed]
- Is it possible Different templates of products for specific category in WooCommerce?
- WooCommerce – Adding Product Attributes to CSV Export
- WordPress and WooCommerce How to Assign Attribute Based Pricing
- Create templates from attributes for categories
- How to execute a javascript function just before saving a woocommerce post or a post?
- Change Meta Title seperator and remove on homepage
- WooCommerce Description and Short Description tags removal
- Woocommerce 2.5.5 get billing email from order instance
- Woocommerce products are not displayed on front-end . No products were found matching your selection [closed]
- Custom Text on Product Page based on Shipping Class [closed]
- Shipping Location based on IP (Geolocation)
- How to set a minimum length for username in Woocommerce? [closed]
- How to get term name with link for specific ids
- woocommerce “publish “”product”” webhook
- Creating woocommerce product using WordPress REST API
- Image is not displayed in overridden woocommerce email
- remove categories from product
- woo commerce get all orders item given category
- Add Stripe Connect data to wc_stripe_payment_request
- WooCommerce get default shipping rate & conditions
- Using WooCommerce for payments only?
- Programatically Remove Item from Cart Not Working – Needs Page Refresh
- Set default value field meta_Value [closed]
- Save custom attributes of product in woocommerce
- WooCommerce Cart Link based on Cookie Values
- Woocommerce is_shop not on page slug? [closed]
- Debugging why featured images have stopped showing in WooCommerce on the homepage [closed]
- WooCommerce minimum order amount for specific country excluding local pickup [closed]
- woocommerce list product by id
- Woocommerce Login Redirect to old domain
- How to change a WooCommerce Subscription Deposit and Monthly Payment? [closed]
- how to scrolling image on single product page
- How to display WooCommerce product tag names on home and category pages
- Specifically Link To the “Leave a review” part of product page? [closed]
- Variation Swatches for WooCommerce – too many variations
- Woocommerce pre_get_posts query variation meta data not working
- Can’t hide product attributes with css on WooCommerce Product Page
- Updating product image
- Split in 2 columns add to cart button and variable forms
- Images not uploading on product page of woocommercr
- How to access WC()->cart in CF7 hook wpcf7_special_mail_tags
- woocommerce remove coupon link does not work
- How to integrate e-transfers with checkout in WooCommerce
- Manual Admin Orders search for billing_company
- Woocommerce to get restaurant table numbers in the checkout fields from the url
- Send all emails to Shop Manager along with admin
- Snippet to copy product affiliate link to a custom field
- UX Builder not loading for product description edits
- I need help with storefront theme shop page
- Woocommerce shop page not showing all products
- Wrong Billing Information in WC_Checkout->get_checkout_fields(‘billing’)?
- How to display two different custom taxonomy terms on a WooCommerce single product page
- Registration roles
- Change password notification email
- How to show price update date in product single page?
- Sending billing details via POST request to an API
- how can my customers view their purchased products history like an invoice in a specific page on WordPress
- How do I make my products on the homepage responsive?
- How to get users data from wordpress woocomerce database to display
- WooCommerce Registration, Sync User, Billing and Shipping info
- Woocommerce on Subdirectory
- How to customize product at cart page
- WooCommerce Storefront site-header padding
- WooCommerce: How can I add a certain product to the cart and redirect to the cart from a non-shop page?
- How to check which shortcode is using my template?
- woocommerce: when adding or removing items to cart , it takes cart a few seconds to read changes?
- How to get woocommerce integration instance?
- Create woocommerce order on new user registration
- How to put a date range in a virtual/downloadable product? [closed]
- Redirect whole website or pages to /wp-admin in wordpress
- Changing sale price programmatically, but it’s not shown on front-end
- How to get sub items of parent menu item?
- Storefront Child Theme show product attribute [closed]
- How to remove slug from Product category URL in Woocommerce
- Removing ‘woocommerce-no-js’ class from body
- Create WordPress account on different domain when WooCommerce order completed
- Creating a woocommerce order when a user creates an account
- I want to update shipping charge $0 for all Woocommeerce Subscription auto-renewal orders