Skip to content

wc_get_template_part filter missing $slug #40

@florent-cdl

Description

@florent-cdl

Hi,
I'm trying to include a custom template for my product card item inside the worpress loop of archive-product.blade.php template using wc_get_template_part('content', 'simpleproduct') (as wc_get_template_part('content', 'product') is working)
I've got an error, whatever slug and custom template name I tried to load.

Debugging your woocommerce class and woocommerceserviceprovider it seems your filter wc_get_template_part doesn't have enough args length and the function in charge of loading templates parts the wrong arguments compare to offical hook :

Yours :

add_filter('wc_get_template_part', [$woocommerce, 'template']);
public function template(string $template, string $templateName = ''): string
Official :
add_filter( 'wc_get_template_part', 'wp_kama_wc_get_template_part_filter', 10, 3 );
function wp_kama_wc_get_template_part_filter( $template, $slug, $name )

So the template path to search is missing $slug and never find the right template

Please can you have a look
Thank you
Florent

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions