Fixing QIT PHP Compatibility for WooCommerce Marketplace Submissions

code, javascript, html, programmer, programming, angular, internet, java, css, software, digital, hacker, php, function, network, online, program, www, intellectually, monitor, cyberspace, github, corona app, app, operating system, github, github, github, github, github

In a recent Business Bloomer Club Slack thread, a member sought advice on submitting a plugin to the WooCommerce Marketplace.

The challenge was passing the Quality Insights Tool (QIT) PHP Compatibility check when using Composer dependencies, like Symfony MBString polyfill, which triggered false positives.

Despite using conditional loading for PHP 8.0+ and comments to bypass checks, the issue persisted.

Understanding the QIT PHP Compatibility Check

The QIT tool helps ensure plugins meet WooCommerce’s strict quality guidelines, including PHP version compatibility. It scans files for potential issues and flags any code that may be incompatible with supported PHP versions. However, certain files used for backward compatibility or alternative environments may cause false positives, making it harder to pass the assessment.

Moving Dependencies to the Vendor Directory

One recommended approach is placing all Composer dependencies within the /vendor/ directory. The QIT tool typically ignores files located in this folder. Tools like WPify Scoper can help by prefixing Composer dependencies and organizing them into a separate directory within /vendor/, reducing the risk of conflicts and false positives.

Using PHP Sniffs for Local Testing

Running PHP Code Sniffer (PHPCS) with WooCommerce’s custom sniffs locally allows developers to identify compatibility issues before submitting to the Marketplace. This avoids the long wait times associated with the online QIT tests. Installing and configuring WooCommerce sniffs enables comprehensive pre-submission checks:

composer require woocommerce/woocommerce-sniffs
vendor/bin/phpcs --standard=WooCommerce path/to/your/plugin

Avoiding Manual Edits to Composer Files

While adding comments to bypass checks directly in dependency files is possible, it’s not recommended due to maintenance and update challenges. Instead, handling compatibility at the packaging level with a script or build process ensures a cleaner, more maintainable approach.

Getting Support for QIT and Composer Issues

If false positives persist, reaching out to the WooCommerce Developer Relations team or posting an issue on the QIT CLI GitHub repository can provide direct insights from the developers maintaining the tool. Additionally, joining the WooCommerce vendor Slack community grants access to peer and official support for resolving complex compatibility challenges.

Conclusion

Successfully navigating QIT compatibility checks is crucial for WooCommerce Marketplace submissions. Leveraging the /vendor/ directory, local sniffs, and official support channels ensures a smoother process and improves the chances of approval. By applying these strategies, developers can maintain high-quality plugins that meet WooCommerce’s standards without sacrificing compatibility or performance.

Related content

Rodolfo Melogli

Business Bloomer Founder

Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza. Follow @rmelogli

Reply

Your email address will not be published. Required fields are marked *