• Resolved Sphinxxxx

    (@sphinxxxx)


    Great plugin, but while making a webshop with WooCommerce, I noticed it doesn’t work with the “Add product gallery images” on a Product page. I’m guessing WooCommerce creates and sends startup settings to the “media frame” in a slightly different way than usual: Code here

    Anyway, with the help of this wordpress.stackexchange post, I added some code to default-media-uploader-view.js, and made it work. Any chance this could be added in the next version of your plugin?

    ...
        if ( media ) {
            media.view.MediaFrame.Select.prototype.initialize = function() {
                media.view.MediaFrame.prototype.initialize.apply( this, arguments );
    
                //** NEW CODE **
                //Fix for WooCommerce Product Gallery
                this.states.forEach(function(st) {
                    var lib = st.get('library');
                    if(lib) {
                        lib.props.set('uploadedTo', wp.media.view.settings.post.id);
                        lib.props.set('orderby', 'menuOrder');
                        lib.props.set('order', 'ASC');
                    }
                });
                //** END NEW CODE **
    
                _.defaults( this.options, {
                    selection: [],
                    library: {
                                uploadedTo: media.view.settings.post.id,
                                orderby: 'menuOrder',
                                order: 'ASC'
                    },
                    ...

    https://wordpress.org/plugins/default-media-uploader-view/

Viewing 1 replies (of 1 total)
  • Plugin Author leemon

    (@leemon)

    I tested your fix and apparently it works, so I added it to the next version of the plugin. Thanks!

Viewing 1 replies (of 1 total)
  • The topic ‘WooCommerce Product Gallery’ is closed to new replies.