• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Get all WooCommerce products within own plugin

phpwordpresswoocommerceproducthook-woocommerce


PHP Snippet 1:

if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
        // Put your plugin code here
        add_action( 'woocommerce_loaded', 'generate_product_qr_codes' );
    }
    
    function generate_product_qr_codes() {
    
        $args        = array( 'post_type' => 'product', 'posts_per_page' => -1 );
        $products    = get_posts( $args );
        echo '<pre>$products:-';
        print_r( $products );
        echo '</pre>';
    }

Related Snippets

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

enable Apache http Authorization header

how to retrieve the first and last instance of a row in pdo dataset

Wordpress wpdb->delete issue

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

run a query using EXECUTE BLOCK to prepair a column for an unique-Index

CodeIgniter extend CI_URI undefined method

How do I truncate a decimal in PHP?

MongoDB Duplicate Documents even after adding unique key

Convert string to lowercase AND then convert it to its original form in PHP, is it possible?

dockerizing Laravel + vue

Coinpayments create_transaction "ERROR: Invalid command!"

Woocommerce Checkout - Add conditional field required if one field is filled

How do I refresh a DIV content?

How to disable only_full_group_by option in Laravel

About Contact Privacy policy Terms and conditions