populating extra field with woocommerce categories

ok, solution: $args = array( ‘order’ => ‘ASC’, ‘hide_empty’ => $hide_empty, ‘include’ => $ids, ‘posts_per_page’ =>’-1′ ); $product_categories = get_terms( ‘product_cat’, $args ); (isset($_POST[“Cianfrusaglie”])) ? $company = $_POST[“Cianfrusaglie”] : $company=1; echo “<select name=”cat_shop” id=’reg_cat_shop’ class=”dokan-form-control input-md valid”>”; foreach( $product_categories as $category ){ echo “<option “; ?><?php if ($cat_shop == esc_html( $category->name ) ) echo ‘selected’ … Read more

Correct method of reducing the number of images created by WP and Woo together

I would remove the image sizes that you don’t need. function remove_image_sizes() { remove_image_size(‘image-name’); } add_action(‘init’, ‘remove_image_sizes’, 99); Whilst the number of images is a factor, I’d also look at the image compression as this may be a big help in reducing the disk space required: add_filter(‘jpeg_quality’, function($arg){return 70;}); You will need to re-generate your … Read more

Updating WooCommerce product field when product author updates profile field

So combined with that code for setting the value before it’s inserted in the db, you also need to add this code to add the post ID to an array stored in the user’s meta (after it has been updated): add_action( ‘wp_insert_post’, ‘smyles_update_user_products’, 10, 3 ); function smyles_update_user_products( $post_ID, $post, $update ) { if ( … Read more

Adding a second button next to the shop button Woocommerc [closed]

Code is tested with 2019 theme. Open the functions.php file of your active theme and drop this code at end of the file. add_action( ‘woocommerce_after_shop_loop_item’, ‘wpse2019_add_pdf_download_button’, 10 ); function wpse2019_add_pdf_download_button() { global $product; if( $product ) { printf( ‘<a href=”https://wordpress.stackexchange.com/questions/329837/%s” class=”pdf-button button btn” role=”button”>%s</a>’, “YOUR PDF LINK HERE”, __( ‘DWONLOAD PDF’, ‘text-domain’ ) ); } … Read more

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