WooCommerce – Where is functions.php?

Woocommerce is a plugin. The functions.php file is a Theme component, which is auto-loaded by WordPress Core when the theme boots. While Woocommerce, or any other plugin, may have a file named functions.php but such is not required and it is not the functions.php typically referenced here and elsewhere when people suggest adding code that … Read more

Why do Woocommerce templates use hooks rather than get_template_part

I’m not familiar with Woocommerce, but in short, get_template_part() only look for template parts in parent and child themes, not in plugins. If you look at the source code, get_template_part() uses locate_template which have the following source code (which is where the actual template part is searched for) function locate_template($template_names, $load = false, $require_once = … Read more

Override core woocommerce class

1) There is a hook for the first one: You can use the apply_filters Their code: apply_filters( ‘woocommerce_get_discounted_price’, $price, $values, $this ); Your code: add_filter( ‘woocommerce_get_discounted_price’, function($price, $values, $this) { //return whatever you want },10,3 ); //*PHP 5.3 and up you can pass whatever function you want into the second parameter of the add_filter function. … Read more

Taxonomy , subtaxonomy,child taxonomy of a product woocommerce

Based on this answer, here is my function to get all your terms in an array : function get_term_ancestors($post_id, $taxonomy){ // Declare the array where we are going to store the terms $ancestors = array(); // start from the current term $parent = array_shift(get_the_terms($post_id,$taxonomy)); // climb up the hierarchy until we reach a term with … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)