Forum Replies Created

Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter Tuba Saif

    (@tuba121)

    I found many themes remove woocommerce default hooks and make their own .I think that’s why woocommerce general hooks not works for them. Now i found a solution for removing meta and base category from woocommerce single product but struggling with removing breadcrumb from woocommerce single product page. Following is the code for category.

    function remove_category($terms, $post_id, $taxonomy) {
    if (is_product() && ‘product_cat’ === $taxonomy) {
    $default_categories = get_terms(array(
    ‘taxonomy’ => ‘product_cat’,
    ‘hide_empty’ => false,
    ));
    $default_category_slugs = array();
    foreach ($default_categories as $default_category) {
    $default_category_slugs[] = $default_category->slug;
    }
    foreach ($terms as $key => $term) {
    if (in_array($term->slug, $default_category_slugs)) {
    unset($terms[$key]);
    }
    }
    }
    return $terms;
    }
    add_filter(‘get_the_terms’, ‘remove_category’, 10, 3);

    Thread Starter Tuba Saif

    (@tuba121)

    Means action/filter hooks may not work on block theme because it uses different structure.right? but they work in classic theme?-I found different ways for removing elements. using init, wp, wphead, template redirect. and one more question- I think blocksy theme using block theme structure because i tried hard to find hooks in its template files but not being found.

    Thread Starter Tuba Saif

    (@tuba121)

    Thanks shameem Reza , I am not using Neve theme , I am learning that’s why I checked on 15 themes , it’s working in Neve , I want consistent code( if any ) that work for all theme.

    Now I found this code.

    // Disable category on product page function custom_product_meta_end() { $buffered_content = ob_get_clean(); $modified_content = preg_replace(‘/<span class=”posted_in”>(.*?)<\/span>/’, ”, $buffered_content); echo $modified_content; } add_action(‘woocommerce_product_meta_end’, ‘custom_product_meta_end’);

    • This reply was modified 8 months, 3 weeks ago by Tuba Saif.
    Thread Starter Tuba Saif

    (@tuba121)

    I was trying to remove product category from woocommerce single product page.I code for this that working fine in all the themes except twenty twenty… But I want to know that when I am editing/overriding either the meta.php or writing any custom code. It is not working in twenty twenty.. themes.

    // Disable category on product page function custom_product_meta_end() { $buffered_content = ob_get_clean(); $modified_content = preg_replace(‘/<span class=”posted_in”>(.*?)<\/span>/’, ”, $buffered_content); echo $modified_content; } add_action(‘woocommerce_product_meta_end’, ‘custom_product_meta_end’);

    Thread Starter Tuba Saif

    (@tuba121)

    Not working , just working for neve theme.Is their any way to remove category using filter and action hooks?that works for all themes

    Thread Starter Tuba Saif

    (@tuba121)

    @riaanknoetze Thanks for covering all aspects. I tried with changing priorties. Now finding the theme specific hooks and functions but i provide a code for price please look into it ,It is modifying the HTML code.

    add_filter(‘woocommerce_get_price_html’, ‘disable_product_prices’, 10, 2);

    function disable_product_prices($price_html, $product) {

        // Return empty string to disable price display

        return ”;

    } Is their any way for categories like price.

    Thread Starter Tuba Saif

    (@tuba121)

    @shameemreza Thank you so much . I am actually trying to create plugin for ajax search with category dropdown using jquery ui autocomplete for my woocommerce site. It’s almost done but i am facing some design issues . can i ask here , if not then on which platform i can ask.

    Thread Starter Tuba Saif

    (@tuba121)

    @doublezed2 okay Thanks for sharing valuable information.

    Thread Starter Tuba Saif

    (@tuba121)

    @shameemreza Thank you so much for your answer .plz tell me can i use this shortcode for my above requirement [product_page] For example: [product_page id="99"] and fetch id’s dynamically.

    Thread Starter Tuba Saif

    (@tuba121)

    I go through your links plugin handbook etc, what i get is to make own function. right? I am using this function wc_get_template_part(‘content’, ‘product’); but it’s not fetching the exact design.What i can do to fetch exact design is their any function or i need to do some css etc.

    • This reply was modified 10 months ago by Tuba Saif.
    • This reply was modified 10 months ago by Tuba Saif.
    Thread Starter Tuba Saif

    (@tuba121)

    Yes you understand well I am trying to create own plugin.Thanks I must check your provided link . can guide me little about it more because I am beginner.

    • This reply was modified 10 months ago by Tuba Saif.
Viewing 11 replies - 1 through 11 (of 11 total)