Product categories don’t appear as option to build menu
On the Menus page, click the Screen Options tab at top right. Then tick the boxes for products and product categories. That will make them available to be added to your menus.
On the Menus page, click the Screen Options tab at top right. Then tick the boxes for products and product categories. That will make them available to be added to your menus.
You can create a product object using the following function: $product = wc_get_product( $post_id ); And after that you will be able to access to all product’s data. All available methods can be found here, but the ones you need are: $product->get_regular_price(); $product->get_sale_price(); $product->get_price();
Core and plugin files should never be edited directly, as any updates could overwrite your changes. If you look in WooCommerce source at the get_price_html method, there are a number of filters available to modify the output of the function. See add_filter in Codex for more info on adding filters to apply_filters calls. From get_price_html … Read more
You can get the WooCommerce my-account URL as below <a href=”https://wordpress.stackexchange.com/questions/213612/<?php echo get_permalink( get_option(“woocommerce_myaccount_page_id’) ); ?>” title=”<?php _e(‘My Account’,”); ?>”><?php _e(‘My Account’,”); ?></a> Now you can insert this in completed order mail template too. <h2> <a href=”https://wordpress.stackexchange.com/questions/213612/<?php echo get_permalink( get_option(“woocommerce_myaccount_page_id’) ); ?>” title=”<?php _e(‘My Account’,”); ?>”>Go to your account page for review</a> </h2> <a href=”http://animax.cf/product/happy-ninja/#reviews”> … Read more
On a hunt for the same I took a little dive into the JS source files. Woocommerce Javascript events Woocommerce Checkout JS events $( document.body ).trigger( ‘init_checkout’ ); $( document.body ).trigger( ‘payment_method_selected’ ); $( document.body ).trigger( ‘update_checkout’ ); $( document.body ).trigger( ‘updated_checkout’ ); $( document.body ).trigger( ‘checkout_error’ ); $( document.body ).trigger( ‘applied_coupon_in_checkout’ ); $( document.body … Read more
I suspect the main problem is that you should be using the WP_Query object rather than get_posts(). The later by default only returns items with a post_type of post not products, So given a category with ID 26, the following code would return it’s products (WooCommerce 3+): $args = array( ‘post_type’ => ‘product’, ‘post_status’ => … Read more
From the __get() method in the WC_Order class you can see that the user_id property is taken from/stored as _customer_user post meta for the order in question. /** * __get function. * * @access public * @param mixed $key * @return mixed */ public function __get( $key ) { // Get values or default if … Read more
OK so here’s how I solved it in the end. A quick and dirty example, uses JQuery. <a id=”buy” href=”#”>Buy this!</a> <script> $(‘#buy’).click(function(e) { e.preventDefault(); addToCart(19); return false; }); function addToCart(p_id) { $.get(‘/wp/?post_type=product&add-to-cart=” + p_id, function() { // call back }); } </script> This just makes an AJAX GET request to the cart url /wp/?post_type=product&add-to-cart=[PRODUCT_ID]