woocommerce – Media library default tab/view

I am using Woocommerce and WCFM – Frontend Manager plugins.

Is it possible to allways open media library “Upload file” tab/view first instead of “Media library” tab/view when adding image or additional gallery image to the product from the vendor dashboard.

woocommerce – Use a variable from a action to another in Wocommerce

the following code is in the file functions.php:

function wp_extracode_for_products()
    <h1>Prueba de AJAX</h1>
        <button type="button" onclick="prueba()">Change Content</button>
    <div id="contenidoEcho"></div>
        function prueba(){
            var xmlhttp = new XMLHttpRequest();
            xmlhttp.onreadystatechange = function() {
                if (this.readyState == 4 && this.status == 200) {
                    document.getElementById("contenidoEcho").innerHTML = this.responseText;
            xmlhttp.open("GET", "http://localhost:10003/?wc-ajax=myaction&q=25", true);


add_action('woocommerce_single_product_summary', 'wp_extracode_for_products', 60);


function myaction($cart_object){

    $q = $_REQUEST("q");
    settype($q, "integer");
    echo gettype($q);
    echo $q;

add_action( 'woocommerce_before_calculate_totals', 'add_custom_price' );

function add_custom_price( $cart_object ) {
    $custom_price = 15;
    foreach ( $cart_object->cart_contents as $key => $value ) { 

My problem is that I want to use the variable $q captured with ajax in $custom_price. Thanks for advance.

woocommerce – Search result page doesn’t load sometimes or loads in a messy way

After searching any product or clicking on menu categories the result page doesn’t show anything and displays an corrupted messy page or nothing at all with error http 500. Results exist but it doesn’t show them or it finally gets displayed after refreshing the page 4 or 5 times.

this is the website links:

How to upload very large JPGs to Media Library for WooCommerce digital download prints

I’m trying to upload a JPG 9927 px x 14043 px through editing a WooCommerce product, and adding a downloadable file. Every time I try, I Receive an error:

Post-processing of the image failed likely because the server is busy
or does not have enough resources. Uploading a smaller image may help.
Suggested maximum size is 2500 pixels.

There is plenty of disk space (20 GB).

I’ve CHMOD all directories from /wp-content onwards to 755, but the issue remains.

The PHP max_upload_size is 128MB, and the images are no more than 35MB in size.

Help appreciated.

jquery – WooCommerce core checkout.js to Query UI Widget, why is it displaying some of my hidden fields at checkout?

This took me a while to even figure out it was this that was doing this.

I have a multi-step checkout and have some fields hidden by default.

I confirmed the hidden fields are indeed in a display:none state on page load.

But, now when loading my Billing Information step in my checkout, I ran a javascript debugger and found out woocommerce core checkout.js is running my billing inputs through its maybe_input_changed() and input_changed() functions (this is simply because I am using my own javascript to programatically update the billing field on the case if a user is logged in and has a billing address saved in their account).

And then after that the JS run’s through the very beginning part of /wp-includes/js/jquery/ui/widget.min.js?ver=1.11.4

!function(t) {
    "function" == typeof define && define.amd ? define(("jquery"), t) : t(jQuery)
}(function(h) {
    var s, i = 0, a = Array.prototype.slice;
    return h.cleanData = (s = h.cleanData,
    function(t) {
        var e, i, n;
        for (n = 0; null != (i = t(n)); n++)

and apparently this cleaning of the Data is re-showing my checkout inputs that are supposed to be hidden.

This seems to be core functionality and jQuery UI Widget 1.11.4, I’m confused as to why thats called, and why it’s doing what its doing (making display:none hidden input elements to display:block ), and how to prevent that…

Anyone know what’s going on here? I had to dig pretty deep to figure out on something relatively simple like the display of input fields if anyone has any insight on this I’d appreciate it

Show WooCommerce catalog and cart totals on one page

Is it possible to show all the catalog of my WooCommerce store and below all the content of the cart page?

I was able to do it (with a custom page) but the shipping calculator doesn’t work.


permalinks – Woocommerce posts and products links works only once and then get 404 error

Permalink to products and post of my website getting 404 error. after saving the permalink type in Setting -> Permalink page they will work correctly. But if I refresh the links they get 404 error again. Actually the links work only once.

this is my .htaccess file:

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^.*-(d+)/$ securityl/index.php?id=$1&%{QUERY_STRING} (L)
RewriteRule ^.*-y(d+)/$ securityl/index.php?cat=$1&%{QUERY_STRING} (L)
RewriteRule ^.*(website(a-z)+map.xml)$  websiteguide/$1 (L)

RewriteBase /

I have changed the theme to store front and it’s not working.

woocommerce – Format number to 2 decimal places

I have created a custom product field which is an auto-calculated field, which is saved to the meta data upon save.
The calculation of the field is carried out live using javascript/jQuery.
However, the calculation is not formating the figure to 2 decimal places:

        jQuery(document).ready(function(jQuery) {
            function compute() {
                var a = jQuery('#_regular_price').val();
                var b = jQuery('#_weight').val();
                var total = a / b;
                var totalformatted = total.toFixed(2);
            jQuery('#_regular_price, #_weight').change(compute);

What am I doing wrong in my code for why this is not working?

I want to show either the WooCommerce Price OR the WooCommerce Bookings Price in a Divi module

I am using WooCommerce combined with WooCommerce Bookings.

We have two types of product, bookable products and nonbookable products. I would like to show the price for the product on the page within a Divi module. We are using Divi to completely style the page of the Divi product so I cannot use an override like I ususally would.

Is there a way to add some PHP code to the functions file then call it as a shortcode in a Divi module?

I tried adding this code to my functions.php within my child theme but when I call it it errors and won’t save the page.


function woo_price_and_bookings_price ($atts)
    global $product;
    $product_id = $product->get_id();
    echo '<h1>The price is: ' . $product->get_price_html() . '</h1>';
add_shortcode( 'price_and_bookings_price', 'woo_price_and_bookings_price' );

shortcode I am calling


The price does not appear, but my text does. However my text appears at the very top of the page and not in the position I have assigned it in Divi. The page also errors on save and seems to automatically open a new page whenever I do this.

The page that opens contains nothing except my code (twice for some reason):

The price is:

What am I doing wrong and is this the right way to approach this task? I need to use Divi as I have inherited the site and we are not using traditional product pages.

Show woocommerce products based on select category using acf

Basically i want to show all the products from a specific category that i select using acf dropdown field.