Unable to enocde the result of wc_get_products

Try: $products_posts_arr = (array) $products_posts; echo json_encode( $products_posts_arr ); OR function object_to_array($data) { if (is_array($data) || is_object($data)) { $result = array(); foreach ($data as $key => $value) { $result[$key] = object_to_array($value); } return $result; } return $data; } $products_posts_arr = object_to_array( $products_posts ); echo json_encode( $products_posts_arr ); Encode array not object, wc_get_products will return object.

Custom product loop avoiding duplicates

Using the developers’ reference example, you are referencing $loop redundantly. Drop the $loop-> before the_post() and have_posts(): if ( have_posts() ) { $term_names = array(); while ( have_posts() ) { the_post(); $myPostID = get_the_ID(); //Uncomment next 3 lines to debug using your error log //ob_start(); //var_dump($myPostID); //error_log(‘myPostID = ‘ . ob_get_clean(),0); $arrProductTerms = wc_get_product_terms( $myPostID, … Read more

Hide woocommerce login form

You miss the required remove_action() parameter — the name of the function to remove. See the Code Reference. <?php add_action( ‘woocommerce_login_form’, ‘woocom_extra_register_fields’ ); function woocom_extra_register_fields () { if ( is_page( ‘installation’ ) ) { remove_action( ‘woocommerce_login_form’, ‘woocom_extra_register_fields’, 10 ); // note this } } I suspect the code you’ve posted is not complete, so, adding … Read more

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