opencredit / badgeos

BadgeOS is a plugin to WordPress that allows you to easily create badges and set up the steps and achievements users take to earn them. Badges are Mozilla OBI compatible and sharable via Credly.
http://www.badgeos.org
GNU Affero General Public License v3.0
92 stars 64 forks source link

BadgeOS Conflicts with WooCommerce Admin: general product data isn't visible for products in admin #718

Open dmfcoops opened 4 years ago

dmfcoops commented 4 years ago

Description

With BadgeOS activated on WordPress 5.3.2 the WooCommerce plugin breaks. Various editable fields in WooCommerce Admin are no longer visible when adding or editing products eg Regular Price field and Sales Price field

Steps to Reproduce

  1. Login to Wordpress Dashboard
  2. Install BadgeOS
  3. Install WooCommerce
  4. Install WooCommerce Memberships
  5. Open WooCommerce list of Products
  6. Select a product or create a new product
  7. Scroll down to Product Data

Actual result:

In the General tab of the Product Data section in WooCommerce Admin, no price fields are visible, and the product type dropdown menu isn't visible. Other input fields are missing (see screenshots for comparison)

Expected result:

I expect to see regular price field, sales price field, product type dropdown menu and other missing fields

Product Versions

Additional Information

Deactivated all plugins and add-ons to test for conflicts and only the BadgeOS plugin caused this conflict with WooCommerce. Deactivating the BadgeOS Learn-Dash Add On did not fix the issue. deactivating BadgeOS fixes the issue with WooCommerce.

No changes have been made to core Wordpress and plugin PHP files

Using DIVI theme

Actual Result Expected Result
graemebenzie commented 4 years ago

My workaround is to dequeued badgeOS plugin styles by adding this to my theme's functions.php.

/* Deregister stylesheets that break WooCommerce's drop downs when on a WooCommerce admin page */
add_action('admin_print_styles', 'remove_badgeos_admin_styles_scripts', 5);
function  remove_badgeos_admin_styles_scripts() {

    if( isWooCommerceAdminPage() ) {

        // 'BadgeOS' plugin
        wp_dequeue_style('badgeos-select2-css');
        wp_dequeue_style('badgeos-juqery-autocomplete-css');
        wp_dequeue_script('badgeos-select2');

        // 'BadgeOS Interactive Progress Map Add-On' plugin
        wp_dequeue_script('progress_map_admin-select2');
        wp_dequeue_style('progress_map_admin-select2-css');

        // 'BadgeOS Social Sharing' plugin
        wp_dequeue_style('bos-ss-admin-select2-css');
        wp_dequeue_script('bos-ss-admin-select2-js');
    }

}

function isWooCommerceAdminPage() {
    /*  
        WooCommerce admin pages get params  
        page = wc-reports
        page = wc-settings
        page = wc-status
        page = wc-addons

        post_type = shop_order
        post_type = shop_coupon
        post_type = product
        post_type = product
        post_type = product
        post_type = product
        post_type = product
    */
    global $post;
    return (    $post->post_type == 'product' ||
                in_array( $_GET['page'], array('wc-reports', 'wc-settings', 'wc-status', 'wc-addons') ) ||
                in_array( $_GET['post_type'], array('shop_order', 'shop_coupon', 'product' ) ) );
}