Set a custom field to all orders

You can achieve this via the save_post hook as per the following example: function wpse_374688_save_post( $post_id, $post, $update ) { // only update orders (post_type=shop_order) if ( ‘shop_order’ !== $post->post_type ) { return; } update_post_meta( $post_id, ‘activecampaign_for_woocommerce_accepts_marketing’, 1 ); } add_action( ‘save_post’, ‘wpse_374688_save_post’, 10, 3 ); This callback will run each type a post_type of … Read more

Skip WooCommerce 4.5.x onboarding with WP-CLI [closed]

Not very sure, but maybe you need to install WooCommerce pages? wp option set woocommerce_onboarding_opt_in “yes” wp option set woocommerce_onboarding_profile “” wp option set woocommerce_store_address “street address number” wp option set woocommerce_store_address_2 “” wp option set woocommerce_store_city “Mycity” wp option set woocommerce_store_postcode “1234” wp option set woocommerce_default_country “BE” wp wc –user=admin tool run install_pages

‘profile_update’ hook alternative for WooCommerce user meta data

My solution would be this: function get_all_user_data($user_id) { $user_data = get_userdata($user_id); $login = $user_data->user_login; $customer_array = new WC_Customer( $user_id ); $customer = $customer_array->get_data(); $billing_first_name = $customer[billing][first_name]; $shipping_first_name = $customer[shipping][first_name]; } add_action(‘user_register’,’get_all_user_data’); add_action(‘profile_update’,’get_all_user_data’); The array setup for the Customer arrays [billing] and [shipping] is as so (you can just change my values and get different data … Read more

Server-Based CRON Job

I think you can resolve this with this way: Step 1: You create a PHP Page with URL you want in your theme like this (page-url-custom-cron.php) to call a Hook WooCommerce Step 2: You use server-based job Curl to the URL: http://yourdomain/url-custom-cron. And now the PHP code page will call WooCommerce hooks for you. Hope … Read more

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