Changing Woocommerce Product Description [closed]

Instead of editing the template you could also try this: <?php /** Remove short description if product tabs are not displayed */ function dot_reorder_product_page() { if ( get_option(‘woocommerce_product_tabs’) == false ) { remove_action( ‘woocommerce_single_product_summary’, ‘woocommerce_template_single_excerpt’, 20 ); } } add_action( ‘woocommerce_before_main_content’, ‘dot_reorder_product_page’ ); /** Display product description the_content */ function dot_do_product_desc() { global $woocommerce, $post; … Read more

Delete option doesn’t appear for plugins

D’oh. I fixed it, but I’ll leave this question in case others have similar problems. When copy/pasting various options into wp-config.php I accidentally included this setting, which I don’t normally use: // Overkill but FYI: disallows installation/updating of any theme or plugin define(‘DISALLOW_FILE_MODS’,true); That produces the described problem, albeit by design.

Get Current user email as a return string value

I will approach like this: global $current_user; get_currentuserinfo(); $email = (string) $current_user->user_email; var_dump($email); You just called got the email from the current_user array and cast it into string 🙂 that’s it

Create WooCommerce Product Category Programmatically

To create a taxonomy term programmatically you can use wp_insert_term function. <?php wp_insert_term( $term, $taxonomy, $args = array() ); ?> It has 3 params: $term (int|string) (required) The term to add or update. Default: None $taxonomy (string) (required) The taxonomy to which to add the term. Default: None $args (array|string) (optional) Change the values of … Read more

Woocommerce checkout page custom checkbox ticked

In WooCommerce checkboxes have always a value of ‘1’. So you do not need to pass ‘value’ => true: it does nothing. To set checkbox checked or not WooCommerce uses the WP checked function where 1 (integer) is compared with the value you pass as third param in woocommerce_form_field. Pass 1 as default and your … Read more

Add code into on a per page/post basis

As you said per page/post basis, this would work for each post add_action(‘wp_head’, ‘add_link_in_head’); function add_link_in_head() { global $post; if(!empty($post)) { $alternate = get_post_meta($post->ID, ‘alternate’, true); $hreflang = get_post_meta($post->ID, ‘hreflang’, true); if(!empty($alternate) && !empty($hreflang)) { ?> <link rel=”alternate” href=”https://wordpress.stackexchange.com/questions/110260/<?php echo $alternate; ?>” hreflang=”<?php echo $hreflang; ?>” /> <?php } } } If there is no … Read more

Convert WordPress posts to products in WooCommerce

You could install the Post Type Switcher plugin Or Run SQL query on your database to change the post to product post type UPDATE `wp_posts` SET `post_type` = ‘product’ WHERE `post_type` = ‘post’; Backup your DB 1st. UPDATE `wp_posts` SET `post_type` = ‘wpsc-product’ WHERE `post_type` = ‘post’;