Display WooCommerce size product attribute on shop page

Your code is outdated since WooCommerce 3. First, you need to target variable products type only to avoid errors on other products types and also $product is already the product object. Also you can also directly use the WC_Product method get_attribute() and your code will be much more simpler, compact and efficient: add_action( ‘woocommerce_after_shop_loop_item_title’, ‘display_size_attribute’, … Read more

Adding existing user custom field value to a woocommerce product [closed]

You can do this with an action when a new product is inserted (and not when updated). As you did not specify the meta key this field is stored under the user as, OR the meta key of where you want it stored on the product: add_action( ‘wp_insert_post’, ‘smyles_insert_user_product_data’, 10, 3 ); function smyles_insert_user_product_data( $post_ID, … Read more

How to Acheive the custom woocommerce category template

Lets see if this is helpfull. From your description you have/want the following setup: -Category –Sub-Category-1 —Products of Sub-Category-1 –Sub-Category-2 —Products of Sub-Category-2 –Sub-Category-3 —Products of Sub-Category-3 OK, so you first need to get all top level categories. You can get them with something like this: $top_categories_args = array( ‘taxonomy’ => ‘product_cat’, // the taxonomy … Read more

Get WooCommerce Email Classes in Backend

Like I’ve pointed in my comment, you can use wc()->mailer()->emails, which would give you a list of all the email class instances. Example: // Get all the email class instances. $emails = wc()->mailer()->emails; // Prints all the email class names. var_dump( array_keys( $emails ) ); // Access the default subject for new order email notifications. … Read more

Using Cookie Data For WP_Query Loop

You need to explode the comma separated string to get the array of IDs. Follow the below code. $cookie_array = $_COOKIE[“your-results”]; // Test output echo $cookie_array; $cookie_array = array_map( ‘absint’, (array) explode(‘,’, $cookie_array) ); $sug_args = array( ‘post_type’ => ‘product’, ‘post__in’ => $cookie_array, ); $sug_query = new WP_query ($sug_args); if( $sug_query->have_posts() ) : while( $sug_query->have_posts() … Read more

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