Hi there!
If you’ve set it up correctly and you’re just duplicating the template file without modifications, then I would expect it to work.
Have you been using the Theme Developer Handbook as a guide? In the Declaring WooCommerce Support section it references the code you’re using above – just to check, do you also call that function, with something like this?
add_action( ‘after_setup_theme’, ‘mytheme_add_woocommerce_support’ );
On the page linked above, there’s also an Examples section at the bottom, containing themes you can look at closer to see how they did it.
Thread Starter
olgamm
(@olgamm)
Hello,
I will check again the developer handbook, just in case, and yes, I call the add_action method.
Thank you for your reply. I will check the documentation a little more and come back
Hello @olgamm,
I will check the documentation a little more and come back
That sounds like a good plan. I’ll mark this issue as closed, but feel free to create a new issue, if you have any additional questions regarding WooCommerce.
Thread Starter
olgamm
(@olgamm)
I found the problem. So I will post my answer here, if someone else has a similar issue.
My problem was with jQuery. In my theme I was un-loading and reloading jquery, with the below code
function load_JQuery()
{
wp_deregister_script('jquery');
wp_register_script('jQuery', get_template_directory_uri().'/js/jQuery-3.5.1.min.js','', 1,true);
wp_enqueue_script('jQuery');
}
add_action('wp_enqueue_scripts','load_JQuery');
and this conflicts with the woocommerce, so I decided to stay with the default jquery that wordpress uses. So I deleted the previous code and added the bellow
function load_javascript()
{
//Load default jquery
wp_enqueue_script('jquery');
//Set as dependency file jQuery [ array('jquery') ]
wp_register_script('bootstrap_js', get_template_directory_uri().'/js/bootstrap.min.js',array('jquery'), 1,true);
wp_enqueue_script('bootstrap_js');
}
add_action('wp_enqueue_scripts','load_javascript');
Also in my js file I used the bellow syntax
(function($) {
$(document).ready(function(){
//jQuery code ....
})
})( jQuery );
This is the link that helped me about the jquery
https://travis.media/how-to-setup-and-use-jquery-in-your-wordpress-theme/
Hi @olgamm! Thank you for circling back to share your solution to help other members of the community. I’m going to go ahead and mark this thread resolved. Please start a new thread if you have any other questions.