Categories not shown in admin after adding woocommerce products via wp wc cli
After opening issue on woocommerce github page and authors reaction. The solution is wp wc product create –name=”Product Name” –categories=”[ { “id” : 21 } ]” –user=admin
After opening issue on woocommerce github page and authors reaction. The solution is wp wc product create –name=”Product Name” –categories=”[ { “id” : 21 } ]” –user=admin
Internally, WooCommerce uses WordPress’ wp_safe_redirect() which does not allow redirects to external hosts. In order to get around this, we must add our desired host to the whitelist. The whitelist can be modified using the allowed_redirect_hosts which has been demonstrated below: /** * Adds example.com to the list of allowed hosts when redirecting using wp_safe_redirect() … Read more
You can use get_the_term_list() to output a comma-separated list of links to product categories: <?php while ( $loop->have_posts() ) : $loop->the_post(); ?> <li class=”product-list__item”> <a href=”https://wordpress.stackexchange.com/questions/274473/<?php the_permalink() ?>”> <?php the_title(); ?> </a> <?php echo get_the_term_list( get_the_ID(), ‘product_cat’, ”, ‘, ‘ ); ?> </li> <?php endwhile; ?> Note that when you’re inside ‘the loop’ (i.e. between … Read more
The templates are, by definition, the mechanism to define how a certain woocommerce page would look, and child themes are, by definition, the way you change a behavior of a theme beyond what it allows for in the Admin UI. Overriding the templates in a child theme is the best practice. (Bear in mind that … Read more
I think you missing function argument. just try it. add_filter(‘wp_mail_content_type’,’set_content_type’); function set_content_type($content_type){ return ‘text/html’; }
Add this to your functions.php function custom_pre_get_posts_query( $q ) { $tax_query = (array) $q->get( ‘tax_query’ ); $tax_query[] = array( ‘taxonomy’ => ‘product_tag’, ‘field’ => ‘slug’, ‘terms’ => array( ‘banana’ ), // Don’t display products with the tag “banana” ‘operator’ => ‘NOT IN’ ); $q->set( ‘tax_query’, $tax_query ); } add_action( ‘woocommerce_product_query’, ‘custom_pre_get_posts_query’ );
Yes, after an order created you can get details of it. The woocommerce_payment_complete hook is fired when the payment is completed. The only variable passed is the order id, though from that you can get the order object, and ultimately the user. add_action( ‘woocommerce_order_status_completed’, ‘so_payment_complete’ ); function so_payment_complete( $order_id ){ $order = wc_get_order( $order_id ); … Read more
add_action(‘woocommerce_after_add_to_cart_button’,’cmk_additional_button’); function cmk_additional_button() { echo ‘<button type=”submit” class=”button alt”>Change me please</button>’; } add this code in your Child theme functions.php Try this code
global $woocommerce; $count = $woocommerce->cart->cart_contents_count; This should be the variable you’d want to work with. Try var_dump on this to display its value.
After looking in cart.php, it doesn’t look like you can do that with hooks, as there is static html that wraps around the product price content. That product price content is what is affected by the woocommerce_cart_item_price hook that you’ve tried, but not the containing static html markup for the column structure itself. The good … Read more