How can i put php code on the wordpress page?

I think using the user_registration hook is probably the best fit for what you want to do. An example from the docs: add_action( ‘user_register’, ‘myplugin_registration_save’, 10, 1 ); function myplugin_registration_save( $user_id ) { if ( isset( $_POST[‘first_name’] ) ) update_user_meta($user_id, ‘first_name’, $_POST[‘first_name’]); } To be compliant with the WordPress way (and be less likely to … Read more

Show number of sold products but be first for less than 2

OK, so if anyone else is looking for the answer for this I figured it out after a bit more sleep. I had to get rid of the return and the second function. So the code now looks like this add_action( ‘woocommerce_single_product_summary’, ‘my_units_sold_counts’, 19 ); function my_units_sold_counts($units_sold) { global $product; $units_sold = get_post_meta( $product->id, ‘total_sales’, … Read more

PHP – Woocommerce 3.2 Add variable shipping insurance with multiple “else if ” conditions

Solved! I had the statements in the wrong order, the first if statement was satisfied so none of the others were checked. Reversed them and voila! I also could have added a <= to each statement //General Fall back for shipping and cart totals <= 50 $insurance_fee = 0; $chosen_methods = WC()->session->get( ‘USPS_Simple’ ); $chosen_shipping … Read more

how can i import the csv file in wordpress woocommerce.?

Haroon, In the past, I’ve used this paid extension through the WooCommerce store: https://woocommerce.com/products/product-csv-import-suite/ However, WooCommerce is in the process of phasing that plugin’s functionality into their core release: https://docs.woocommerce.com/document/product-csv-importer-exporter/ If the default core option does not yet meet your needs I would recommend checking out their paid extension. One other tip: I would suggest … Read more