Woocommerce – how to tell if product post has variations or not

Use $product->is_type() function to check the product type. To check if the product is a variable product use: global $product; // $product->is_type( $type ) checks the product type, string/array $type ( ‘simple’, ‘grouped’, ‘variable’, ‘external’ ), returns boolean if ( $product->is_type( ‘variable’ ) ) {} There is also $product->get_type() function that returns the internal type … Read more

WooCommerce payment complete hook

The woocommerce_payment_complete hook is fired when the payment is completed. The only variable passed is the order id, though from that you can get the order object, and ultimately the user. add_action( ‘woocommerce_payment_complete’, ‘so_payment_complete’ ); function so_payment_complete( $order_id ){ $order = wc_get_order( $order_id ); $user = $order->get_user(); if( $user ){ // do something with the … Read more

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