How to query only for products with status “in stock” in WooCommerce? [closed]
That worked great! Just added this: ‘meta_query’ => array( array( ‘key’ => ‘_stock_status’, ‘value’ => ‘instock’, ‘compare’ => ‘=’, ) ) Thanks!
That worked great! Just added this: ‘meta_query’ => array( array( ‘key’ => ‘_stock_status’, ‘value’ => ‘instock’, ‘compare’ => ‘=’, ) ) Thanks!
If you don’t want to fix this every time WooCommerce updates, just create a filter in your child-theme: function overrule_webhook_disable_limit( $number ) { return 999999999999; //very high number hopefully you’ll never reach. } add_filter( ‘woocommerce_max_webhook_delivery_failures’, ‘overrule_webhook_disable_limit’ );
Try something like this global $product; if ( ! $product->managing_stock() && ! $product->is_in_stock() ) echo ‘<p>This product is out of stock. It can be purchased by custom made order.</p>’;
Here’s my code for creating a subscription — it took a lot of trial and error to figure it all out. Best of luck! function create_test_sub() { $email=”[email protected]”; $start_date=”2015-01-01 00:00:00″; $address = array( ‘first_name’ => ‘Jeremy’, ‘last_name’ => ‘Test’, ‘company’ => ”, ’email’ => $email, ‘phone’ => ‘777-777-777-777’, ‘address_1′ => ’31 Main Street’, ‘address_2’ => … Read more
WP/WooCommerce REST API cart/checkout/order [closed]
Using the [woocommerce_my_account] shortcode, a user will see their account details if they’re logged in and if they’re not logged in, they’ll see a login and registration form. Using the same page title “My Account” for these different users isn’t ideal because a user that has never created an account won’t naturally navigate to a … Read more
Have did some customization. This will help you show parent and child category images. You can later customize this code as per your requirements. $taxonomyName = “product_cat”; //This gets top layer terms only. This is done by setting parent to 0. $parent_terms = get_terms($taxonomyName, array(‘parent’ => 0, ‘orderby’ => ‘slug’, ‘hide_empty’ => false)); echo ‘<ul>’; … Read more
Add this to your functions.php add_action( ‘woocommerce_single_product_summary’, ‘dev_designs_show_sku’, 5 ); function dev_designs_show_sku(){ global $product; echo ‘SKU: ‘ . $product->get_sku(); } This will output the product SKU below the product title. See image below. The product SKU is VERTEX-SLVR.
One problem with the way WordPress handles hooks is that to remove a specific hook with an OOP callback, you must have access to the exact same instance of the class as when the callback was added. This is generally easy enough to handle in your own plugins/themes. However, it makes it nearly impossible to … Read more
Just use global $product then use get_attribute() method of that product object, like below- $size = $product->get_attribute( ‘pa_size’ ); And you can also get that by below code- global $product; $size = array_shift( wc_get_product_terms( $product->id, ‘pa_size’, array( ‘fields’ => ‘names’ ) ) ); Rememeber you need to use must the global $product.