• 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

How to validate Envato Purchase Code in PHP

How to use functions that are declared in snippets in Evolution CMS (Modx) in an external PHP Script?

php 7 php.ini upload_max_filesize not working

Required field only if another field has a value, must be empty otherwise

Laravel UUID generation

Add customer email and phone in "Order" column to admin orders list on Woocommerce

Sliders in Laravel

Laravel: Why is my variable not being set while it's in the construct function of the controller?

Limit of log line written to Apache Errorlog from mod php error_log

How to convert binary string to normal string in php

WooCommerce Additional Information - if empty, hide

Laravel/docker-compose/redis - Class 'Redis' not found

How to solve Duplicate entry '0' for key 'PRIMARY' in Wordpress?

What is the difference between client-side and server-side programming?

How to redirect to another page after n seconds in wordpress without using javascript?

About Contact Privacy policy Terms and conditions