Streamlining WooCommerce with Aras Cargo Integration Using Bash Scripting
Introduction
Efficient shipping integration is crucial for WooCommerce stores. For small to mid-sized businesses, our WooCommerce-Aras Cargo Integration offers a pluginless, server-side bash scripting solution. This guide will walk you through the setup, features, and benefits of this innovative approach.
Quick Start: One-Liner Installation
You can quickly install the integration with a single command:
sudo bash < <(curl -Ss https://psaux-it.github.io/woo-aras-setup.sh)
sudo bash < <(wget -q -O - https://psaux-it.github.io/woo-aras-setup.sh)
What does woo-aras-setup.sh
do?
The woo-aras-setup.sh script simplifies the integration process by:
- Detecting the Linux Distribution: Identifies and installs required runtime packages.
- Creating a Secure Environment: Sets up a new system user with limited sudo privileges.
- Downloading the Source Code: Fetches the latest integration code to the user’s home directory.
- Setting Locale: Installs necessary locale settings for character encoding.
- Executing Main Script: Runs the woocommerce-aras-cargo.sh
script.
- Installation Status: Prints a status report for quality assurance.
Integration Overview
This solution integrates WooCommerce with Aras Cargo using bash scripts and the free AST plugin. It listens for new cargo tracking numbers from Aras and updates the corresponding WooCommerce order statuses.
Top-Level Directory & File Layout
├── custom-order-status-package # Holds build-time dependencies (twoway) │ ├── aras-woo-delivered.php # Two-way installation │ ├── class-wc-delivered-status-order.php # Two-way installation │ ├── fallback-order-status-sql.php # Two-way uninstallation │ ├── functions.php # Two-way installation │ └── wc-customer-delivered-status-order.php # Two-way installation ├── emails # Holds runtime dependencies │ ├── delivered.min.html # Delivered html mail template │ └── shipped.min.html # Shipped html mail template ├── lck # Holds encrypted runtime dependencies ├── tmp # Holds data for debugging ├── CHANGELOG # Documentation file ├── README.md # Documentation file ├── woo-aras-setup.sh # Setup executable └── woocommerce-aras-cargo.sh # Main executable
Key Features
- Automated Order Updates: Changes order status from ‘processing’ to ‘completed/shipped’ when a tracking number is generated.
- Email Notifications: Adds tracking information to order completion emails using the AST plugin.
- Two-Way Workflow Support: For more detailed tracking, updates order status to ‘delivered’ and sends a notification email.
Installation and Configuration
Script Functions
- woo-aras-setup.sh:
- Installs required packages.
- Sets up a new user and environment.
- Downloads integration source code.
- Configures locale settings.
- Runs the main script.
- woocommerce-aras-cargo.sh:
- Updates order statuses and handles error checking.
Dependencies
Ensure your server has the necessary dependencies:
- Runtime Packages: curl, jq, PHP with SOAP, GNU awk, and sed.
- Mail Server: For notifications, configure a mail server like postfix.
Supported Linux Distributions
The integration supports a wide range of Linux distributions, including:
- Debian
- Ubuntu
- CentOS
- Fedora
- Oracle Linux
- RHEL
- Arch
- Manjaro
- Gentoo
- SUSE
- openSUSE Leap
- openSUSE Tumbleweed
Two-Way Workflow Installation
For businesses needing detailed tracking, the two-way workflow updates order statuses from shipped to delivered. This setup involves:
- Child Theme Configuration: All modifications are applied to the child theme.
- Script Execution: The script can auto-detect the child theme path or allow manual setup.
Manual Steps:
- Create necessary directories in the child theme.
- Copy relevant files from the custom-order-status-package.
- Update the child theme’s functions.php
file to include the new functionality.
- Check the WooCommerce admin panel for the new ‘delivered’ status.
Benefits of a Pluginless Approach
- Reduced Complexity: Simplifies the integration process.
- Lower Costs: Eliminates plugin licensing fees.
- Enhanced Performance: Faster execution compared to plugin-based solutions.
- Improved Security: Fewer third-party plugins reduce security risks.
Advanced Features
- Error Handling and Debugging: Robust error handling mechanisms and debugging parameters to troubleshoot issues.
- Mail Notifications: Notifications for shop managers via mail, supporting various mail servers.
- Auto Upgrade: Supports automatic upgrades to the latest version, which can also be scheduled via cron jobs.
Detailed Features
- Interactive Setup: Automatically prepares the environment and installs needed packages.
- Adjustable User Options: Customize settings like delivery time, maximum distance, and job schedule.
- User Control: Full control over automation with useful arguments.
- Encrypted Sensitive Data: REST and SOAP credentials are hardened.
- Powerful Error Handling: Checks for SOAP and REST API connections.
- Easy Debugging: Useful search parameters for troubleshooting.
- Automation Statistics: Provides insights and statistics.
- Support for Installation Methods: Cron and systemd support.
- Logrotate Support: Ensures logs are managed efficiently.
- HTML Notify Mails: Shop manager notifications in HTML format.
- Easy Auto Upgrade: Seamless upgrades to the latest version.
- Strong String Matching: Levenshtein distance function for accurate string matching.
User-Defined Settings
Before starting, configure settings like delivery time, maximum distance, job schedule timer, etc., specified in the script comments. These settings are persistent, so you only need to set them once.
Debugging
If you encounter issues, debugging parameters are available to display related log files. Use –force-shipped to adjust the two-way workflow in case of discrepancies between Aras Cargo and WooCommerce statuses.
Conclusion
The WooCommerce-Aras Cargo Integration using bash scripting is a streamlined, cost-effective solution for small to mid-sized e-commerce businesses. By automating the order tracking process and minimizing manual updates, this integration saves time and reduces errors. For more information and to get started, visit the WooCommerce-Aras Cargo GitHub repository. Implementing this solution will enhance your e-commerce operations, ensuring a smoother, more reliable shipping experience for both you and your customers.