wp_customize – detect post type to show/hide customizer options

Customizer Controls can be displayed based on context. With active_callback API introduced in WordPres 4.0, you can control where to show your specific options. Add your customizer options like this with the optional active_callback argument. $wp_customize->add_control( ‘wc_cart_page_option’, array( ‘label’ => esc_html__( ‘Cart Page Options’ ), ‘section’ => ‘wc_cart’, ‘active_callback’ => ‘estore_is_cart’, )); Now create a … Read more

Remove the link from the thumbnail and product title on woocommerce

It’s a bit hard to tell without knowing what shop theme you are using but I’ll try anyways…  The code <?php wc_get_template_part( ‘content’, ‘product’ ); ?> is basically calling the template file content-product.php. I would however not recommend you alter the default file. On a standard woocommerce install you will find that default template file … Read more

How to change a column width on WooCommerce orders page (Admin)

To set a different column width for the Ship to, add this to your functions.php: add_action( ‘admin_head’, ‘wpse_237354_ship_to_column’ ); function wpse_237354_ship_to_column() { global $pagenow; if ( $pagenow == ‘edit.php’ ) { ?> <style type=”text/css”> .manage-column.column-shipping_address { width: 10px; } </style> <?php } } This adds custom CSS in the header page with your new column … Read more

Unable to update Woocommerce Product Permalink

Add this code to your functions.php– add_action( ‘init’, ‘the_drmatist_category_base’ ); function the_drmatist_category_base() { // Remember to flush the rules once manually after you added this code! add_rewrite_rule( // The regex to match the incoming URL ‘news/([^/]+)/([^/]+)/([^/][^f][^e][^e][^d]+)(/[0-9]+)?/?$’, //here my changes to exclude ‘feed’ // The resulting internal URL ‘index.php?product_cat=$matches[1]/$matches[2]&name=$matches[3]&paged=$matches[4]’, // Add the rule to the top … Read more

how i can add more required * fields in checkout page?

If you at least know how to open your “functions.php” file, the following should work if you simply add it at the bottom of your functions.php file of your (child-)theme: // Hook in add_filter( ‘woocommerce_checkout_fields’ , ‘custom_add_checkout_fields’ ); // Our hooked in function – $fields is passed via the filter! function custom_add_checkout_fields( $fields ) { … Read more

remove categories from product

I have found the solution, actually it is very simple: $terms = get_the_terms($product_id, ‘product_cat’); foreach($terms as $term){ wp_remove_object_terms($product_id, $term->term_id, ‘product_cat’); } This code get all the therms with the ‘product_cat’ taxonomy, with a foreach loop I remove all the items.