Woocommerce My Account Endpoint – how to get ID parameter from URL?
I hope it’s not too late, but anyway, I know it will help someone else. echo get_query_var(‘your-endpoint’); So, for your code, it will be: echo get_query_var(‘view-subscription’);
I hope it’s not too late, but anyway, I know it will help someone else. echo get_query_var(‘your-endpoint’); So, for your code, it will be: echo get_query_var(‘view-subscription’);
Default attributes of WooCommerce variable products are stored as post meta in the database. You can find them in the wp_postmeta table, where the post_id column is the post ID of the parent product (Variable product), and the meta_key column is _default_attributes. You can clear and remove default attributes of all products by replacing all … Read more
I’m not sure exactly what you are doing, but the following code did work for me in that it created a new product and added it to the cart. Note, I had to use $_GET to test on my setup since I don’t have the rest of your code and didn’t feel like creating a … Read more
I just made it for a client, you’ll have to do it on the pre_get_posts action. That means you will add parameters to the WordPress query before it returns the posts. Add this to functions.php: // advanced search functionality function advanced_search_query($query) { if($query->is_search()) { // category terms search. if (isset($_GET[‘category’]) && !empty($_GET[‘category’])) { $query->set(‘tax_query’, array(array( … Read more
Arrrrg a WooCommerce question… quick burn him at the stake! There’s a couple of problems with your callback function above: you are not declaring global $woocommerce so you do not have access to the $woocommerce global variable. and $woocommerce->customer holds the state of the WC_Customer class however this class does not contain a get_role() method, … Read more
Try this code in functions.php inside your theme folder. add_filter( ‘woocommerce_email_order_items_args’, ‘iconic_email_order_items_args’, 10, 1 ); function iconic_email_order_items_args( $args ) { $args[‘show_image’] = true; return $args; }
You can use wordpress referrer function. For example set referrer URL in session by clicking on add to cart button or any button to store previous URL. Once login or register success add Woocommerce success login redirect to that URL. For more information read WordPress referrer URL read here; https://codex.wordpress.org/Function_Reference/wp_get_referer For Woocommerce login redirect read … Read more
Try, woocommerce_checkout_create_order_line_item It has 4 available arguments and available after version WooCommerce 3.3+. $item is an instance of WC_Order_Item_Product new introduced Class $cart_item_key is the cart item unique hash key $values is the cart item $order an instance of the WC_Order object (This is a very useful additional argument in some specific cases) In this … Read more
There are missing things in your select field and it should be better to use a hooked function to embed it in the product inside the add to cart form (if you want to be able to get the posted value). So below is the complete way from displaying and saving the selected size everywhere … Read more
I see two problems with the code you’ve written. The first one is that the_title() echos the post title although returning the title would be more appropriate in this context. Also wp_reset_postdata() should be after the while loop inside the if statement. But as you mentioned that you only need the post titles, you can … Read more