Skip to main content

Make the order ref the same as the order ID

To make the order reference in PrestaShop 8.2 the same as the order ID, you'll need to modify the Order.php file. This involves changing the generateReference() function to return the order ID instead of a random alphanumeric string.
Here's a step-by-step guide:
  1. Locate the Order.php file: Navigate to the PrestaShop installation directory, then go to classes/order/Order.php.
  2. Open the Order.php file: Open the file using a text editor.
  3. Find the generateReference() function: Locate the generateReference() function within the Order class.
  4. Modify the function: Replace the existing code within the generateReference() function with the following:
public static function generateReference($order_id) {
        return $order_id;
    }
This code directly returns the order ID as the reference.
  1. Save the file: Save the changes to Order.php.
  2. Clear the cache: To ensure the changes are reflected, clear the PrestaShop cache. You can do this by navigating to your PrestaShop backend, going to "Performance," and then clicking "Clear Cache".
  3. Verify the changes: Place a test order to verify that the order reference now matches the order ID.
  • Hits: 6