I want to add custom add to cart link [closed]

Your problem is that get_page_by_path() returns a WP_Post object, not a WC_Product object. You need a WC_Product object, because that’s the object that contains the product_type property. You can get a WC_Product from a WP_Post via the wc_get_product() function: $post_obj = get_page_by_path( $slug, OBJECT, ‘product’ ); // this code help me to get product detials … Read more

remove product-category base but still redirect to page with same permalink

Have a look at this https://kellenmace.com/remove-custom-post-type-slug-from-permalinks/ I use it with this plugin: Code Snippets By Shea Bunge This allows you to modify your functions.php file without having to directly edit it. This means WordPress core and theme updates won’t remove your changes. Finally, may I suggest you try using a staging plugin to make a … Read more