• 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

Explode not working properly with dash

How can I stop a symfony process which is listening on http://127.0.0.1:8000

generate an Excel file using PHP

How to add automatically collapse/expand in content wordpress (single.php)?

php curl_exec() Connection refused when retrieving a remote image

woocommerce change position of price

Adding the custom page with add_menu_page function on Wordpress

Attempt to read property "view" on null when sending password reset email

laravel automatically deletes server.php on php artisan serve

I want to display a sweetalert after the inserting of data in my database

Create tags in laravel post publishing

SilverStripe unable to populate multiple member Childs

500 (Internal Server Error) with Laravel & Docker [duplicate]

Don't show recurring price for WooCommerce subscriptions worth 0$

XDebug not working in VScode for php debugging

About Contact Privacy policy Terms and conditions