Hot answers tagged

2

function woocommmerce_style() { wp_enqueue_style('woocommerce_stylesheet', WP_PLUGIN_URL. '/woocommerce/assets/css/woocommerce.css',false,'1.0',"all"); } add_action( 'wp_head', 'woocommmerce_style' ); paste the above code in your "functions.php". woocommerce stylesheet will be executed to your site


1

Looks to me you should be seeking a woocommerce purchase completion hook. This would be when you could add that a donation has been made and at what amount, then you could grab any user information, amounted donated and other info you need and save it to your donor table. use this: add_action('woocommerce_order_status_completed', 'save_to_donors',10,1); ...


1

This action hook allows you to access data for a new user immediately after they are added to the database. The user id is passed to hook as an argument. Not all user meta data has been stored in the database when this action is triggered. For example, nickname is in the database but first_name and last_name. The password has already been encrypted when ...


1

Googling get_terms gives the WP developer hub page for get_terms as the first result, for which the first example is this: $terms = get_terms( 'post_tag', array( 'hide_empty' => false, ) ); Using this as a basis we get: $args = array( 'taxonomy' => 'product_cat', 'number' => 5, 'orderby' => 'name', 'parent' => 11, '...


1

I tried another solution and that did the trick. I found in the WooCommerce docs this little snippet: // Display 24 products per page. Goes in functions.php add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );. It is overriding the settings in the customizer. I only have to change the number '24' to my liking.


1

You're passing two parameters to _n function, the first one is the pattern for one item, and the second for 2 or more. Just change the pattern. Show only numbers: <?php echo sprintf (_n( '%d', '%d',count( WC()->cart->get_cart())),count( WC()->cart->get_cart())); ?> Show item for two or more: <?php echo sprintf (_n( '%d', '%d items',...


1

Anything outside the <?php ?> tags will be echoed as output since it has no conditions. The fastest way is to wrap in a function and output in the footer. add_action('wp_footer','custom_random_script'); function custom_random_script() { echo '<script> ......SCRIPT CONTENTS...... </script>'; } There is nothing technically ...


1

Remove return; from your code, which is prematurely exiting the function before the following two lines can be executed; that is why the status is not changed. function my_change_status_function () { global $post; $ordernumber = get_post_meta( $post->ID, 'order_number', true ); $audit_status = get_post_meta( $post->ID, 'audit_status', ...



Only top voted, non community-wiki answers of a minimum length are eligible