Description
Integración SAG ERP connects a WooCommerce store to the SAG ERP document insertion service operated by P&A Soluciones Integradas S.A.S. It helps merchants prepare and submit accounting documents based on WooCommerce orders without manually re-entering product lines in their ERP.
The plugin requires an existing SAG ERP account, access to SAG API, a valid API token, and the document fields assigned to your company. Installing the plugin does not create a SAG account, activate SAG API access, or transmit past orders. The integration sends order information to the external SAG service only after the store administrator configures the service and explicitly enables automatic sending.
What this plugin does
- Builds a local JSON preview for any accessible WooCommerce order before it is sent to SAG ERP.
- Uses each product or variation SKU as the SAG article code.
- Resolves units per purchased variation automatically when the attributes are unambiguous. An optional per-variation unit factor is available for exceptions; simple products default to one physical unit per item.
- Uses the regular unit price and calculates two sequential reductions: the product’s regular-to-sale price discount and an additional discount from coupons.
- Uses the original WooCommerce order creation date as the document date.
- Provides configurable company-specific document fields, warehouse code, NIT or identity-document metadata key, and observation templates.
- Allows a merchant to select whether automatic processing is triggered by orders entering Processing, Completed, or either status.
- Keeps an order-level event history, HTTP status, sanitized SAG response summary, and duplicate-submission safeguards.
- Does not send an invoice during JSON preview; it does not synchronize stock or automatically resend an ambiguous invoice.
Implementation assistance
Please contact ventas@pya.com.co for assistance with SAG API access, the implementation process, field mapping, and validating your configuration. SAG API product information is available at https://pya.com.co/api/ .
Getting started: step-by-step setup
- Confirm the requirements. Install and activate WooCommerce. Obtain a working SAG ERP service account, permission to use SAG API, your API token, and the document settings specific to your company. If you need assistance, please contact ventas@pya.com.co.
- Back up your site. Make a backup of the WordPress database and plugin files before installing or upgrading. If an older integration is installed in the separate
woocommerce-integracion-erpdirectory, deactivate it first. Do not run both plugins at once. - Install the plugin. Open WordPress administration > Plugins > Add New Plugin > Upload Plugin. Select this ZIP file, install it, and activate Integración SAG ERP.
- Open the settings. Go to WooCommerce > Integración SAG. The default insertion endpoint is
https://wssagrest.azurewebsites.net/InsercionSag; verify that this is the correct HTTPS service for your SAG ERP installation. - Configure access. Enter your SAG API token in the private token field and save the settings. The token is not included in the downloadable plugin. Do not send your token to the support team in plain-text email.
- Configure the company. Enter your SAG document creator code, document source, receipt source, prefix, zone, seller identifier, bank account code, currency, payment method, SAG username, movement ID, warehouse code, and other fields requested by your SAG implementation. Set the WooCommerce metadata key that holds the buyer’s NIT or identity number.
- Configure invoice behavior. Choose Processing, Completed, or both as the order-status trigger. Review the observations template, including
{pedido}(order number) and{productos_variacion}(product names and quantities per variation). Products must have the SKU expected by SAG. - Preview without sending. Keep automatic submission disabled. Create a test order or select an existing order, then use the order preview on WooCommerce > Integración SAG. Check customer identification, document date, SKU, physical quantities, regular unit prices, both discount percentages, taxes, warehouse code, observations and header fields.
- Review the data-transfer terms. Review the external-service disclosure and P&A privacy policy below, confirm that you have an appropriate agreement and permission to send customer data to SAG, and update your store’s privacy notice when required.
- Enable sending only after testing. Verify the request contract with your SAG service representative. Configure the commit setting as instructed by SAG, confirm the contract in the plugin settings, and explicitly enable automatic submission. Only subsequent eligible order-status transitions trigger sending; installation does not bulk-send old orders.
- Monitor the results. Use WooCommerce > Integración SAG > event and transmission diagnostics to review the event, HTTP status, and sanitized response summary for a particular order. Do not retry an invoice that has a confirmed or uncertain result until you have reconciled it with SAG ERP.
External services
Service provider: P&A Soluciones Integradas S.A.S. (SAG ERP / SAG API).
Service information: https://pya.com.co/api/
SAG REST document insertion endpoint: https://wssagrest.azurewebsites.net/InsercionSag . The site administrator may specify another public HTTPS endpoint for their SAG environment. The endpoint is not called simply by installing, activating or previewing the plugin.
Purpose: Create accounting documents in SAG ERP using orders and product information from a WooCommerce store.
When data is sent: The plugin makes a POST request only after an administrator enters the connection information, explicitly confirms the contract and enables automatic submission, and an order enters the configured status. Viewing settings, previewing JSON, or consulting local diagnostics does not send an API request.
What is transmitted: The SAG API token for authentication; document type and configured business/accounting identifiers; the buyer’s NIT or identity-document number from order metadata; original order date; product SKUs; purchased quantities and physical units per variation; regular unit prices; taxes and discount percentages; warehouse code; invoice observations (which may contain product descriptions and the WooCommerce order number). This data is shared with the merchant’s configured SAG service to create the corresponding accounting document. The plugin does not submit customer passwords or payment card details.
Data stored by the plugin: The configured SAG token and settings are stored in the WordPress database. The plugin also records invoice transmission flags and sanitized diagnostic summaries on WooCommerce orders. It does not intentionally log raw request/response bodies, credentials, or the complete JSON payload. Access to the token-reveal control is restricted to administrators; treat saved credentials as confidential.
Provider privacy policy: https://pya.com.co/politica-de-privacidad/ (published by P&A Soluciones Integradas S.A.S.).
Service terms and account agreement: Access to SAG API and the service conditions are governed by the merchant’s agreement with P&A. For the applicable terms and implementation assistance, please contact ventas@pya.com.co before enabling the integration. See also the SAG API service information at https://pya.com.co/api/ .
Store owners remain responsible for ensuring they have a lawful basis for sharing customer/order data, for notifying their customers as required, and for reviewing their own contract and data-processing obligations with SAG ERP. This plugin relies on an external service and cannot issue SAG documents without it.
Installation
- Make a full backup of your site and database.
- Ensure WooCommerce is active.
- Upload the plugin ZIP from WordPress > Plugins > Add New Plugin > Upload Plugin, then activate it.
- Open WooCommerce > Integración SAG and configure your own SAG endpoint, token, NIT or identity-document field, business identifiers, and trigger status.
- Preview a test order with automatic sending disabled. Verify all invoice fields.
- Review the P&A privacy policy and applicable SAG service terms, then confirm the REST contract and enable automatic sending when ready.
- Check the order diagnostics after a test transmission. Contact ventas@pya.com.co if you need help implementing the integration.
If upgrading from a version installed in the old woocommerce-integracion-erp folder, first deactivate the old plugin. This package continues to use the integracion-sag-erp-for-woocommerce directory and retains the existing settings and order metadata names. Never keep two different copies of the integration active at the same time.
FAQ
-
Does installing the plugin automatically create invoices?
-
No. A store administrator must configure SAG credentials, confirm the service contract and enable automatic submission. Old orders are not automatically transmitted after installation.
-
Can I test the connection without creating an invoice?
-
You can preview the generated order JSON without contacting SAG. To test a real API response, coordinate a safe test transaction and commit setting with your SAG service representative.
-
Do all variable products need the same attribute name?
-
No. The plugin looks at attributes on each purchased variation. If multiple numeric values are ambiguous, it stops and asks for clarification instead of inventing a quantity. An explicit factor per variation is available for exceptions.
-
What is sent for simple products?
-
For a simple product, each purchased item represents one physical unit by default. Its SKU must correspond to an article code in SAG ERP.
-
How are sale discounts and coupons handled?
-
The first discount is the percentage from the regular line price to the pre-coupon subtotal. The second is the additional percentage from that subtotal to the final line total. These are sequential percentages, not additive.
-
How do I include product names and variation quantities in observations?
-
Configure an observations template such as
Purchased through WooCommerce: {productos_variacion}. Order #{pedido}.The placeholder expands to the product names and quantities recorded on each order line. -
Why is a submission blocked after an error?
-
An HTTP or transport error may not prove whether SAG committed a document. The plugin blocks automatic retries after uncertain outcomes to reduce the risk of duplicate accounting records. Check SAG ERP before attempting any re-submission.
-
Does the plugin synchronize SAG inventory with WooCommerce?
-
No. This version handles order invoicing only. It does not change WooCommerce stock quantities based on SAG balances.
-
Where can I get help with implementation?
-
Please contact ventas@pya.com.co for help connecting your WooCommerce store to SAG ERP. Service details: https://pya.com.co/api/ .
Reviews
There are no reviews for this plugin.
Contributors & Developers
“Integración SAG ERP” is open source software. The following people have contributed to this plugin.
ContributorsTranslate “Integración SAG ERP” into your language.
Interested in development?
Browse the code, check out the SVN repository, or subscribe to the development log by RSS.
Changelog
1.7.8
- Expand the English description, first-time setup guide, external-service disclosure, and support information.
- Add the provider’s official published privacy policy and SAG API service page to the readme.
- Document that service terms are governed by the merchant’s agreement with P&A and that help is available at ventas@pya.com.co.
- Update the plugin version and short description. No changes to invoice calculations, credentials, hooks, payloads, or transmission logic.
1.7.7
- Use the display name Integración SAG ERP.
- Keep the WordPress compatibility declaration in the readme, and improve administrative validation.
1.7.6
- Add
{productos_variacion}observation placeholders for product names and units per variation.
1.7.5
- Change token review to a protected administrator form instead of an AJAX call.
1.7.4
- Update the plugin folder, documentation and settings labels while keeping existing configuration identifiers.
1.7.3
- Add sanitized response diagnostics and confirmed, rejected and unconfirmed transmission results.
1.7.2
- Add automatic unit detection for variations and preview diagnostics.
